File tree 1 file changed +20
-11
lines changed
1 file changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -1318,17 +1318,26 @@ 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 => {
1323
+ for _ in 1 ..num_lines {
1324
+ line_start = line_start + BytePos ( d. read_u8 ( ) as u32 ) ;
1325
+ lines. push ( line_start) ;
1326
+ }
1327
+ }
1328
+ 2 => {
1329
+ for _ in 1 ..num_lines {
1330
+ line_start = line_start + BytePos ( d. read_u16 ( ) as u32 ) ;
1331
+ lines. push ( line_start) ;
1332
+ }
1333
+ }
1334
+ 4 => {
1335
+ for _ in 1 ..num_lines {
1336
+ line_start = line_start + BytePos ( d. read_u32 ( ) ) ;
1337
+ lines. push ( line_start) ;
1338
+ }
1339
+ }
1340
+ _ => unreachable ! ( ) ,
1332
1341
}
1333
1342
}
1334
1343
You can’t perform that action at this time.
0 commit comments