@@ -15,7 +15,7 @@ use std::io::prelude::*;
15
15
use std:: path:: Path ;
16
16
17
17
pub struct ExpectedError {
18
- pub line : usize ,
18
+ pub line_num : usize ,
19
19
pub kind : String ,
20
20
pub msg : String ,
21
21
}
@@ -53,15 +53,15 @@ pub fn load_errors(testfile: &Path, cfg: Option<&str>) -> Vec<ExpectedError> {
53
53
54
54
rdr. lines ( )
55
55
. enumerate ( )
56
- . filter_map ( |( line_no , ln ) | {
56
+ . filter_map ( |( line_num , line ) | {
57
57
parse_expected ( last_nonfollow_error,
58
- line_no + 1 ,
59
- & ln . unwrap ( ) ,
58
+ line_num + 1 ,
59
+ & line . unwrap ( ) ,
60
60
& tag)
61
61
. map ( |( which, error) | {
62
62
match which {
63
63
FollowPrevious ( _) => { }
64
- _ => last_nonfollow_error = Some ( error. line ) ,
64
+ _ => last_nonfollow_error = Some ( error. line_num ) ,
65
65
}
66
66
error
67
67
} )
@@ -91,23 +91,21 @@ fn parse_expected(last_nonfollow_error: Option<usize>,
91
91
. skip_while ( |c| !c. is_whitespace ( ) )
92
92
. collect :: < String > ( ) . trim ( ) . to_owned ( ) ;
93
93
94
- let ( which, line ) = if follow {
94
+ let ( which, line_num ) = if follow {
95
95
assert ! ( adjusts == 0 , "use either //~| or //~^, not both." ) ;
96
- let line = last_nonfollow_error. unwrap_or_else ( || {
97
- panic ! ( "encountered //~| without preceding //~^ line." )
98
- } ) ;
99
- ( FollowPrevious ( line) , line)
96
+ let line_num = last_nonfollow_error. expect ( "encountered //~| without \
97
+ preceding //~^ line.") ;
98
+ ( FollowPrevious ( line_num) , line_num)
100
99
} else {
101
100
let which =
102
101
if adjusts > 0 { AdjustBackward ( adjusts) } else { ThisLine } ;
103
- let line = line_num - adjusts;
104
- ( which, line )
102
+ let line_num = line_num - adjusts;
103
+ ( which, line_num )
105
104
} ;
106
105
107
106
debug ! ( "line={} tag={:?} which={:?} kind={:?} msg={:?}" ,
108
107
line_num, tag, which, kind, msg) ;
109
-
110
- Some ( ( which, ExpectedError { line : line,
108
+ Some ( ( which, ExpectedError { line_num : line_num,
111
109
kind : kind,
112
110
msg : msg, } ) )
113
111
}
0 commit comments