File tree Expand file tree Collapse file tree 1 file changed +14
-11
lines changed Expand file tree Collapse file tree 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 {
13181318 let mut line_start: BytePos = Decodable :: decode ( d) ;
13191319 lines. push ( line_start) ;
13201320
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 ! ( ) ,
13321335 }
13331336 }
13341337
You can’t perform that action at this time.
0 commit comments