File tree Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Expand file tree Collapse file tree 1 file changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -16,21 +16,32 @@ use std::path::Path;
1616
1717use style:: { Result , StyleChecker } ;
1818
19+ /// Relative to `src/`.
20+ const SKIP_PREFIXES : & [ & str ] = & [
21+ // Don't run the style checker on the reorganized portion of the crate while we figure
22+ // out what style we want.
23+ "new/" ,
24+ ] ;
25+
1926#[ test]
2027fn check_style ( ) {
21- let root_dir = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "../src" ) ;
22- walk ( & root_dir ) . unwrap ( ) ;
28+ let src_root = Path :: new ( env ! ( "CARGO_MANIFEST_DIR" ) ) . join ( "../src" ) ;
29+ walk ( & src_root ) . unwrap ( ) ;
2330 eprintln ! ( "good style!" ) ;
2431}
2532
26- fn walk ( root_dir : & Path ) -> Result < ( ) > {
33+ fn walk ( src_root : & Path ) -> Result < ( ) > {
2734 let mut style_checker = StyleChecker :: new ( ) ;
2835
2936 for entry in glob:: glob ( & format ! (
3037 "{}/**/*.rs" ,
31- root_dir . to_str( ) . expect( "dir should be valid UTF-8" )
38+ src_root . to_str( ) . expect( "dir should be valid UTF-8" )
3239 ) ) ? {
3340 let entry = entry?;
41+ let relpath = entry. strip_prefix ( src_root) . expect ( "known path" ) ;
42+ if SKIP_PREFIXES . iter ( ) . any ( |pfx| relpath. starts_with ( pfx) ) {
43+ continue ;
44+ }
3445
3546 let name = entry
3647 . file_name ( )
You can’t perform that action at this time.
0 commit comments