Skip to content

Commit

Permalink
refactor: Rename variable
Browse files Browse the repository at this point in the history
		The fold chaining is to find max line number rather than line number width
  • Loading branch information
chengr4 committed Aug 30, 2024
1 parent ca60949 commit a894e16
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/renderer/display_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a894e16

Please sign in to comment.