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;
16
16
17
17
use style:: { Result , StyleChecker } ;
18
18
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
+
19
26
#[ test]
20
27
fn 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 ( ) ;
23
30
eprintln ! ( "good style!" ) ;
24
31
}
25
32
26
- fn walk ( root_dir : & Path ) -> Result < ( ) > {
33
+ fn walk ( src_root : & Path ) -> Result < ( ) > {
27
34
let mut style_checker = StyleChecker :: new ( ) ;
28
35
29
36
for entry in glob:: glob ( & format ! (
30
37
"{}/**/*.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" )
32
39
) ) ? {
33
40
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
+ }
34
45
35
46
let name = entry
36
47
. file_name ( )
You can’t perform that action at this time.
0 commit comments