From a894e16f68264fad409f2ed035f3afb74a24cdc1 Mon Sep 17 00:00:00 2001 From: R4 Cheng Date: Wed, 21 Aug 2024 21:10:23 +0800 Subject: [PATCH] refactor: Rename variable The fold chaining is to find max line number rather than line number width --- src/renderer/display_list.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/renderer/display_list.rs b/src/renderer/display_list.rs index 4b3abf1..516adc5 100644 --- a/src/renderer/display_list.rs +++ b/src/renderer/display_list.rs @@ -72,13 +72,13 @@ impl<'a> fmt::Debug for DisplayList<'a> { impl<'a> Display for DisplayList<'a> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let lineno_width = self.body.iter().fold(None, |max, set| { + let max_lineno = self.body.iter().fold(None, |max, set| { set.display_lines.iter().fold(max, |max, line| match line { DisplayLine::Source { lineno, .. } => std::cmp::max(max, *lineno), _ => max, }) }); - let lineno_width = match lineno_width { + let lineno_width = match max_lineno { None => 0, Some(_max) if self.anonymized_line_numbers => ANONYMIZED_LINE_NUM.len(), Some(0) => 1,