File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,7 @@ impl<'a> fmt::Debug for DisplayList<'a> {
7272
7373impl < ' a > Display for DisplayList < ' a > {
7474 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
75- let max_lineno = self . body . iter ( ) . fold ( None , |max, set| {
76- set. display_lines . iter ( ) . fold ( max, |max, line| match line {
77- DisplayLine :: Source { lineno, .. } => std:: cmp:: max ( max, * lineno) ,
78- _ => max,
79- } )
80- } ) ;
75+ let max_lineno = self . get_max_lineno ( ) ;
8176 let lineno_width = match max_lineno {
8277 None => 0 ,
8378 Some ( _max) if self . anonymized_line_numbers => ANONYMIZED_LINE_NUM . len ( ) ,
@@ -147,6 +142,16 @@ impl<'a> DisplayList<'a> {
147142 }
148143 Ok ( ( ) )
149144 }
145+
146+ fn get_max_lineno ( & self ) -> Option < usize > {
147+ let max_lineno = self . body . iter ( ) . fold ( None , |max, set| {
148+ set. display_lines . iter ( ) . fold ( max, |max, line| match line {
149+ DisplayLine :: Source { lineno, .. } => std:: cmp:: max ( max, * lineno) ,
150+ _ => max,
151+ } )
152+ } ) ;
153+ max_lineno
154+ }
150155}
151156
152157#[ derive( Debug , PartialEq ) ]
You can’t perform that action at this time.
0 commit comments