File tree 1 file changed +14
-11
lines changed
1 file changed +14
-11
lines changed Original file line number Diff line number Diff line change @@ -1318,17 +1318,20 @@ impl<D: Decoder> Decodable<D> for SourceFile {
1318
1318
let mut line_start: BytePos = Decodable :: decode ( d) ;
1319
1319
lines. push ( line_start) ;
1320
1320
1321
- for _ in 1 ..num_lines {
1322
- let diff = match bytes_per_diff {
1323
- 1 => d. read_u8 ( ) as u32 ,
1324
- 2 => d. read_u16 ( ) as u32 ,
1325
- 4 => d. read_u32 ( ) ,
1326
- _ => unreachable ! ( ) ,
1327
- } ;
1328
-
1329
- line_start = line_start + BytePos ( diff) ;
1330
-
1331
- lines. push ( line_start) ;
1321
+ match bytes_per_diff {
1322
+ 1 => lines. extend ( ( 1 ..num_lines) . map ( |_| {
1323
+ line_start = line_start + BytePos ( d. read_u8 ( ) as u32 ) ;
1324
+ line_start
1325
+ } ) ) ,
1326
+ 2 => lines. extend ( ( 1 ..num_lines) . map ( |_| {
1327
+ line_start = line_start + BytePos ( d. read_u16 ( ) as u32 ) ;
1328
+ line_start
1329
+ } ) ) ,
1330
+ 4 => lines. extend ( ( 1 ..num_lines) . map ( |_| {
1331
+ line_start = line_start + BytePos ( d. read_u32 ( ) ) ;
1332
+ line_start
1333
+ } ) ) ,
1334
+ _ => unreachable ! ( ) ,
1332
1335
}
1333
1336
}
1334
1337
You can’t perform that action at this time.
0 commit comments