about summary refs log tree commit diff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2017-05-23 20:17:38 +0200
committerest31 <MTest31@outlook.com>2017-05-23 20:17:38 +0200
commite860655a999ad921eb379d7f220c3e8ad1bcbb54 (patch)
tree45a77fbffd0d61386377fcf669cf24ee9da31232
parent5b13bff5203c1bdc6ac6dc87f69b5359a9503078 (diff)
downloadrust-e860655a999ad921eb379d7f220c3e8ad1bcbb54.tar.gz
rust-e860655a999ad921eb379d7f220c3e8ad1bcbb54.zip
Remove some needless // gate-test- comments
Also, add detection to treat such comments as tidy errors.
We also remove the found_lib_feature code because it
was just repeating the found_feature code. Originally it
was intended to allow for gate-test lines for
lib features, but apparently nobody missed it.
-rw-r--r--src/test/compile-fail-fulldeps/proc-macro/feature-gate-proc_macro.rs3
-rw-r--r--src/test/compile-fail/feature-gate-global_asm.rs2
-rw-r--r--src/tools/tidy/src/features.rs29
3 files changed, 17 insertions, 17 deletions
diff --git a/src/test/compile-fail-fulldeps/proc-macro/feature-gate-proc_macro.rs b/src/test/compile-fail-fulldeps/proc-macro/feature-gate-proc_macro.rs
index 7e32800e0f9..eeede4b8aa1 100644
--- a/src/test/compile-fail-fulldeps/proc-macro/feature-gate-proc_macro.rs
+++ b/src/test/compile-fail-fulldeps/proc-macro/feature-gate-proc_macro.rs
@@ -9,7 +9,6 @@
 // except according to those terms.
 
 // aux-build:attr_proc_macro.rs
-// gate-test-proc_macro
 #![feature(use_extern_macros)]
 
 extern crate attr_proc_macro;
@@ -21,4 +20,4 @@ struct Foo;
 
 fn main() {
     let _ = Foo;
-}
\ No newline at end of file
+}
diff --git a/src/test/compile-fail/feature-gate-global_asm.rs b/src/test/compile-fail/feature-gate-global_asm.rs
index 0560abb6af4..77f61ba47b0 100644
--- a/src/test/compile-fail/feature-gate-global_asm.rs
+++ b/src/test/compile-fail/feature-gate-global_asm.rs
@@ -8,8 +8,6 @@
 // option. This file may not be copied, modified, or distributed
 // except according to those terms.
 
-// gate-test-global_asm
-
 global_asm!(""); //~ ERROR `global_asm!` is not stable
 
 fn main() {}
diff --git a/src/tools/tidy/src/features.rs b/src/tools/tidy/src/features.rs
index ad0d2fa0b36..791b8d77e0b 100644
--- a/src/tools/tidy/src/features.rs
+++ b/src/tools/tidy/src/features.rs
@@ -70,7 +70,7 @@ pub fn check(path: &Path, bad: &mut bool) {
         }
 
         let filen_underscore = filename.replace("-","_").replace(".rs","");
-        test_filen_gate(&filen_underscore, &mut features);
+        let filename_is_gate_test = test_filen_gate(&filen_underscore, &mut features);
 
         contents.truncate(0);
         t!(t!(File::open(&file), &file).read_to_string(&mut contents));
@@ -92,17 +92,20 @@ pub fn check(path: &Path, bad: &mut bool) {
                 },
                 None => continue,
             };
-            let found_feature = features.get_mut(feature_name)
-                                        .map(|v| { v.has_gate_test = true; () })
-                                        .is_some();
-
-            let found_lib_feature = features.get_mut(feature_name)
-                                            .map(|v| { v.has_gate_test = true; () })
-                                            .is_some();
-
-            if !(found_feature || found_lib_feature) {
-                err(&format!("gate-test test found referencing a nonexistent feature '{}'",
-                             feature_name));
+            match features.get_mut(feature_name) {
+                Some(f) => {
+                    if filename_is_gate_test {
+                        err(&format!("The file is already marked as gate test \
+                                      through its name, no need for a \
+                                      'gate-test-{}' comment",
+                                     feature_name));
+                    }
+                    f.has_gate_test = true;
+                }
+                None => {
+                    err(&format!("gate-test test found referencing a nonexistent feature '{}'",
+                                 feature_name));
+                }
             }
         }
     });
@@ -265,4 +268,4 @@ pub fn collect_lib_features(base_src_path: &Path,
         }
     });
     lib_features
-}
\ No newline at end of file
+}