]> git.lizzy.rs Git - rust.git/commitdiff
Some small fixes
authorTakayuki Nakata <f.seasons017@gmail.com>
Sat, 26 Sep 2020 14:10:25 +0000 (23:10 +0900)
committerTakayuki Nakata <f.seasons017@gmail.com>
Sat, 26 Sep 2020 14:10:25 +0000 (23:10 +0900)
clippy_lints/src/write.rs
tests/ui/print_stdout_build_script.rs
tests/ui/print_stdout_build_script.stderr [deleted file]

index 0e9c7098af89dfb0a97da2b84206e81a952808ab..d9d60fffcd7ae79238566aa251c46b8ade76eaf1 100644 (file)
@@ -235,9 +235,8 @@ fn check_item_post(&mut self, _: &EarlyContext<'_>, _: &Item) {
     }
 
     fn check_mac(&mut self, cx: &EarlyContext<'_>, mac: &MacCall) {
-        fn is_build_scripts(cx: &EarlyContext<'_>) -> bool {
-            // We could leverage the fact that Cargo sets the crate name
-            // for build scripts to `build_script_build`.
+        fn is_build_script(cx: &EarlyContext<'_>) -> bool {
+            // Cargo sets the crate name for build scripts to `build_script_build`
             cx.sess
                 .opts
                 .crate_name
@@ -246,7 +245,7 @@ fn is_build_scripts(cx: &EarlyContext<'_>) -> bool {
         }
 
         if mac.path == sym!(println) {
-            if !is_build_scripts(cx) {
+            if !is_build_script(cx) {
                 span_lint(cx, PRINT_STDOUT, mac.span(), "use of `println!`");
             }
             if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
@@ -263,7 +262,7 @@ fn is_build_scripts(cx: &EarlyContext<'_>) -> bool {
                 }
             }
         } else if mac.path == sym!(print) {
-            if !is_build_scripts(cx) {
+            if !is_build_script(cx) {
                 span_lint(cx, PRINT_STDOUT, mac.span(), "use of `print!`");
             }
             if let (Some(fmt_str), _) = self.check_tts(cx, mac.args.inner_tokens(), false) {
index b84bf9124fc8646c075319b7bf736e5ebac3133c..997ebef8a699226eb46fe04ba72c078534a17adf 100644 (file)
@@ -5,7 +5,7 @@
 fn main() {
     // Fix #6041
     //
-    // The `print_stdout` shouldn't be linted in `build.rs`
+    // The `print_stdout` lint shouldn't emit in `build.rs`
     // as these methods are used for the build script.
     println!("Hello");
     print!("Hello");
diff --git a/tests/ui/print_stdout_build_script.stderr b/tests/ui/print_stdout_build_script.stderr
deleted file mode 100644 (file)
index e69de29..0000000