Skip to content

Commit 1f28683

Browse files
ytmimicalebcartwright
authored andcommitted
Update nightly only test with #[nightly_only_test] attribute
1 parent 0fc846f commit 1f28683

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/ignore_path.rs

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,17 @@ mod test {
3737
use crate::config::{Config, FileName};
3838
use crate::ignore_path::IgnorePathSet;
3939

40+
use rustfmt_config_proc_macro::nightly_only_test;
41+
42+
#[nightly_only_test]
4043
#[test]
4144
fn test_ignore_path_set() {
42-
match option_env!("CFG_RELEASE_CHANNEL") {
43-
// this test requires nightly
44-
None | Some("nightly") => {
45-
let config =
46-
Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new(""))
47-
.unwrap();
48-
let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
49-
50-
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
51-
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
52-
assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
53-
}
54-
_ => (),
55-
};
45+
let config =
46+
Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new("")).unwrap();
47+
let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
48+
49+
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
50+
assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
51+
assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
5652
}
5753
}

0 commit comments

Comments
 (0)