about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYacin Tmimi <yacintmimi@gmail.com>2021-11-28 23:39:31 -0500
committerCaleb Cartwright <calebcartwright@users.noreply.github.com>2021-11-29 14:02:02 -0600
commit1f28683ffacebc91b3bc47b94c56690633226ff9 (patch)
tree541f800dc411daca84eecb1045a42365b795037d
parent0fc846f979bc20d556cc07177b384094a421c54c (diff)
downloadrust-1f28683ffacebc91b3bc47b94c56690633226ff9.tar.gz
rust-1f28683ffacebc91b3bc47b94c56690633226ff9.zip
Update nightly only test with #[nightly_only_test] attribute
-rw-r--r--src/ignore_path.rs24
1 files changed, 10 insertions, 14 deletions
diff --git a/src/ignore_path.rs b/src/ignore_path.rs
index d8974e12b8f..7738eee0a76 100644
--- a/src/ignore_path.rs
+++ b/src/ignore_path.rs
@@ -37,21 +37,17 @@ mod test {
     use crate::config::{Config, FileName};
     use crate::ignore_path::IgnorePathSet;
 
+    use rustfmt_config_proc_macro::nightly_only_test;
+
+    #[nightly_only_test]
     #[test]
     fn test_ignore_path_set() {
-        match option_env!("CFG_RELEASE_CHANNEL") {
-            // this test requires nightly
-            None | Some("nightly") => {
-                let config =
-                    Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new(""))
-                        .unwrap();
-                let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
-
-                assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
-                assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
-                assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
-            }
-            _ => (),
-        };
+        let config =
+            Config::from_toml(r#"ignore = ["foo.rs", "bar_dir/*"]"#, Path::new("")).unwrap();
+        let ignore_path_set = IgnorePathSet::from_ignore_list(&config.ignore()).unwrap();
+
+        assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/foo.rs"))));
+        assert!(ignore_path_set.is_match(&FileName::Real(PathBuf::from("bar_dir/baz.rs"))));
+        assert!(!ignore_path_set.is_match(&FileName::Real(PathBuf::from("src/bar.rs"))));
     }
 }