From bb88fb2de76db11bffe822d41799b51365bab365 Mon Sep 17 00:00:00 2001 From: David CARLIER Date: Sat, 10 Jan 2026 08:51:33 +0000 Subject: [PATCH] more: file status made more idiomatic. (#10151) as checking for presence and unwrapping looks inefficient. --- src/uu/more/src/more.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/uu/more/src/more.rs b/src/uu/more/src/more.rs index e882f4028..6c93dce69 100644 --- a/src/uu/more/src/more.rs +++ b/src/uu/more/src/more.rs @@ -837,8 +837,11 @@ impl<'a> Pager<'a> { // Determine progress information to display // - Show next file name when at EOF and there is a next file // - Otherwise show percentage of the file read (if available) - let progress_info = if self.eof_reached && self.next_file.is_some() { - format!(" (Next file: {})", self.next_file.unwrap()) + let progress_info = if self.eof_reached { + self.next_file + .as_ref() + .map(|next_file| format!(" (Next file: {next_file})")) + .unwrap_or_default() } else if let Some(file_size) = self.file_size { // For files, show percentage or END let position = self