@@ -30,36 +30,34 @@ pub fn load_errors(testfile: &Path) -> ~[ExpectedError] {
30
30
}
31
31
32
32
fn parse_expected ( line_num : uint , line : ~str ) -> ~[ ExpectedError ] {
33
- unsafe {
34
- let error_tag = ~"//~";
35
- let mut idx;
36
- match str:: find_str ( line, error_tag) {
37
- None => return ~[ ] ,
38
- Some ( nn) => { idx = ( nn as uint ) + str:: len ( error_tag) ; }
39
- }
33
+ let error_tag = ~"//~";
34
+ let mut idx;
35
+ match str:: find_str ( line, error_tag) {
36
+ None => return ~[ ] ,
37
+ Some ( nn) => { idx = ( nn as uint ) + str:: len ( error_tag) ; }
38
+ }
40
39
41
- // "//~^^^ kind msg" denotes a message expected
42
- // three lines above current line:
43
- let mut adjust_line = 0 u;
44
- let len = str:: len ( line) ;
45
- while idx < len && line[ idx] == ( '^' as u8 ) {
46
- adjust_line += 1 u;
47
- idx += 1 u;
48
- }
40
+ // "//~^^^ kind msg" denotes a message expected
41
+ // three lines above current line:
42
+ let mut adjust_line = 0 u;
43
+ let len = str:: len ( line) ;
44
+ while idx < len && line[ idx] == ( '^' as u8 ) {
45
+ adjust_line += 1 u;
46
+ idx += 1 u;
47
+ }
49
48
50
- // Extract kind:
51
- while idx < len && line[ idx] == ( ' ' as u8 ) { idx += 1 u; }
52
- let start_kind = idx;
53
- while idx < len && line[ idx] != ( ' ' as u8 ) { idx += 1 u; }
54
- let kind = str:: to_lower ( str:: slice ( line, start_kind, idx) . to_owned ( ) ) ;
49
+ // Extract kind:
50
+ while idx < len && line[ idx] == ( ' ' as u8 ) { idx += 1 u; }
51
+ let start_kind = idx;
52
+ while idx < len && line[ idx] != ( ' ' as u8 ) { idx += 1 u; }
53
+ let kind = str:: to_lower ( str:: slice ( line, start_kind, idx) . to_owned ( ) ) ;
55
54
56
- // Extract msg:
57
- while idx < len && line[ idx] == ( ' ' as u8 ) { idx += 1 u; }
58
- let msg = str:: slice ( line, idx, len) . to_owned ( ) ;
55
+ // Extract msg:
56
+ while idx < len && line[ idx] == ( ' ' as u8 ) { idx += 1 u; }
57
+ let msg = str:: slice ( line, idx, len) . to_owned ( ) ;
59
58
60
- debug ! ( "line=%u kind=%s msg=%s" , line_num - adjust_line, kind, msg) ;
59
+ debug ! ( "line=%u kind=%s msg=%s" , line_num - adjust_line, kind, msg) ;
61
60
62
- return ~[ ExpectedError { line : line_num - adjust_line, kind : kind,
63
- msg : msg} ] ;
64
- }
61
+ return ~[ ExpectedError { line : line_num - adjust_line, kind : kind,
62
+ msg : msg} ] ;
65
63
}
0 commit comments