Skip to content

Commit d08c394

Browse files
committed
ci: Skip the new module with style check
1 parent 3356f12 commit d08c394

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

libc-test/test/check_style.rs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,21 +16,32 @@ use std::path::Path;
1616

1717
use 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]
2027
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();
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()

0 commit comments

Comments
 (0)