File tree 1 file changed +12
-7
lines changed
1 file changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -72,13 +72,7 @@ impl<'a> fmt::Debug for DisplayList<'a> {
72
72
73
73
impl < ' a > Display for DisplayList < ' a > {
74
74
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
75
- let max_lineno = self . get_max_lineno ( ) ;
76
- let lineno_width = match max_lineno {
77
- None => 0 ,
78
- Some ( _max) if self . anonymized_line_numbers => ANONYMIZED_LINE_NUM . len ( ) ,
79
- Some ( 0 ) => 1 ,
80
- Some ( max) => ( max as f64 ) . log10 ( ) . floor ( ) as usize + 1 ,
81
- } ;
75
+ let lineno_width = self . get_lineno_width ( ) ;
82
76
83
77
let multiline_depth = self . body . iter ( ) . fold ( 0 , |max, set| {
84
78
set. display_lines . iter ( ) . fold ( max, |max2, line| match line {
@@ -152,6 +146,17 @@ impl<'a> DisplayList<'a> {
152
146
} ) ;
153
147
max_lineno
154
148
}
149
+
150
+ fn get_lineno_width ( & self ) -> usize {
151
+ let max_lineno = self . get_max_lineno ( ) ;
152
+ let lineno_width = match max_lineno {
153
+ None => 0 ,
154
+ Some ( _max) if self . anonymized_line_numbers => ANONYMIZED_LINE_NUM . len ( ) ,
155
+ Some ( 0 ) => 1 ,
156
+ Some ( max) => ( max as f64 ) . log10 ( ) . floor ( ) as usize + 1 ,
157
+ } ;
158
+ lineno_width
159
+ }
155
160
}
156
161
157
162
#[ derive( Debug , PartialEq ) ]
You can’t perform that action at this time.
0 commit comments