From 0ed80c1a18f26490efcd45d37705f97fdf7fe025 Mon Sep 17 00:00:00 2001 From: "C. Titus Brown" Date: Tue, 17 Dec 2024 12:06:06 -0800 Subject: [PATCH] cleanup --- src/core/src/index/revindex/disk_revindex.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/core/src/index/revindex/disk_revindex.rs b/src/core/src/index/revindex/disk_revindex.rs index cf4cd00c94..c12ebe793a 100644 --- a/src/core/src/index/revindex/disk_revindex.rs +++ b/src/core/src/index/revindex/disk_revindex.rs @@ -352,13 +352,12 @@ impl RevIndexOps for RevIndex { .record_for_dataset(dataset_id) .expect("dataset not found"); - let mut name = row.name(); - if name == "" { - name = row.filename(); - } - if name == "" { - name = row.md5(); - } + let name = [row.name(), row.filename(), row.md5()] + .into_iter() + .skip_while(|v| v.is_empty()) + .next() + .unwrap(); // guaranteed to succeed because `md5` always exists + Some((name.into(), size)) } else { None