@@ -75,7 +75,7 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
7575 return ;
7676 }
7777
78- let filen_underscore = filename. replace ( "-" , "_" ) . replace ( ".rs" , "" ) ;
78+ let filen_underscore = filename. replace ( '-' , "_" ) . replace ( ".rs" , "" ) ;
7979 let filename_is_gate_test = test_filen_gate ( & filen_underscore, & mut features) ;
8080
8181 contents. truncate ( 0 ) ;
@@ -88,13 +88,9 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
8888
8989 let gate_test_str = "gate-test-" ;
9090
91- if !line. contains ( gate_test_str) {
92- continue ;
93- }
94-
9591 let feature_name = match line. find ( gate_test_str) {
9692 Some ( i) => {
97- & line[ i+gate_test_str. len ( ) ..line [ i+ 1 .. ] . find ( ' ' ) . unwrap_or ( line . len ( ) ) ]
93+ line[ i+gate_test_str. len ( ) ..] . splitn ( 2 , ' ' ) . next ( ) . unwrap ( )
9894 } ,
9995 None => continue ,
10096 } ;
@@ -133,7 +129,7 @@ pub fn check(path: &Path, bad: &mut bool, quiet: bool) {
133129 name) ;
134130 }
135131
136- if gate_untested. len ( ) > 0 {
132+ if ! gate_untested. is_empty ( ) {
137133 tidy_error ! ( bad, "Found {} features without a gate test." , gate_untested. len( ) ) ;
138134 }
139135
@@ -259,14 +255,11 @@ pub fn collect_lib_features(base_src_path: &Path) -> Features {
259255
260256 map_lib_features ( base_src_path,
261257 & mut |res, _, _| {
262- match res {
263- Ok ( ( name, feature) ) => {
264- if lib_features. get ( name) . is_some ( ) {
265- return ;
266- }
267- lib_features. insert ( name. to_owned ( ) , feature) ;
268- } ,
269- Err ( _) => ( ) ,
258+ if let Ok ( ( name, feature) ) = res {
259+ if lib_features. contains_key ( name) {
260+ return ;
261+ }
262+ lib_features. insert ( name. to_owned ( ) , feature) ;
270263 }
271264 } ) ;
272265 lib_features
@@ -332,11 +325,11 @@ fn map_lib_features(base_src_path: &Path,
332325 f. tracking_issue = find_attr_val ( line, "issue" )
333326 . map ( |s| s. parse ( ) . unwrap ( ) ) ;
334327 }
335- if line. ends_with ( "]" ) {
328+ if line. ends_with ( ']' ) {
336329 mf ( Ok ( ( name, f. clone ( ) ) ) , file, i + 1 ) ;
337- } else if !line. ends_with ( "," ) && !line. ends_with ( " \\ " ) {
330+ } else if !line. ends_with ( ',' ) && !line. ends_with ( '\\' ) {
338331 // We need to bail here because we might have missed the
339- // end of a stability attribute above because the "]"
332+ // end of a stability attribute above because the ']'
340333 // might not have been at the end of the line.
341334 // We could then get into the very unfortunate situation that
342335 // we continue parsing the file assuming the current stability
@@ -394,7 +387,7 @@ fn map_lib_features(base_src_path: &Path,
394387 has_gate_test : false ,
395388 tracking_issue,
396389 } ;
397- if line. contains ( "]" ) {
390+ if line. contains ( ']' ) {
398391 mf ( Ok ( ( feature_name, feature) ) , file, i + 1 ) ;
399392 } else {
400393 becoming_feature = Some ( ( feature_name. to_owned ( ) , feature) ) ;
0 commit comments