diff --git a/src/documents.rs b/src/documents.rs index 3b34919..dc51a9e 100644 --- a/src/documents.rs +++ b/src/documents.rs @@ -26,10 +26,11 @@ impl Document { /// retrieved excerpts can be traced back to their position in the /// source file. fn from_chunk(path: &Path, index: usize, chunk: &str, total: usize) -> Self { - let source = if total > 1 { - format!("{} (part {}/{total})", path.display(), index + 1) - } else { - path.display().to_string() + let source = match total { + total_chunks if total_chunks > 1 => { + format!("{} (part {}/{total})", path.display(), index + 1) + } + _ => path.display().to_string(), }; Self {