about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMara Bos <m-ou.se@m-ou.se>2021-02-02 20:24:42 +0100
committerMara Bos <m-ou.se@m-ou.se>2021-02-03 23:15:51 +0100
commit3f3eb89547522be44308c66c5152c65e1a822bbe (patch)
treebf4b34ec089f2f608b41361a734b0bf2317ae47c
parent753b0b0b80238a24da87137b67040286dfb82c4d (diff)
downloadrust-3f3eb89547522be44308c66c5152c65e1a822bbe.tar.gz
rust-3f3eb89547522be44308c66c5152c65e1a822bbe.zip
Fix/allow non_fmt_panic in clippy tests.
-rw-r--r--src/tools/clippy/tests/missing-test-files.rs14
-rw-r--r--src/tools/clippy/tests/ui/assertions_on_constants.rs2
-rw-r--r--src/tools/clippy/tests/ui/assertions_on_constants.stderr18
-rw-r--r--src/tools/clippy/tests/ui/fallible_impl_from.rs2
-rw-r--r--src/tools/clippy/tests/ui/fallible_impl_from.stderr4
5 files changed, 20 insertions, 20 deletions
diff --git a/src/tools/clippy/tests/missing-test-files.rs b/src/tools/clippy/tests/missing-test-files.rs
index d87bb4be3c3..9cef7438d22 100644
--- a/src/tools/clippy/tests/missing-test-files.rs
+++ b/src/tools/clippy/tests/missing-test-files.rs
@@ -9,14 +9,12 @@ fn test_missing_tests() {
     if !missing_files.is_empty() {
         assert!(
             false,
-            format!(
-                "Didn't see a test file for the following files:\n\n{}\n",
-                missing_files
-                    .iter()
-                    .map(|s| format!("\t{}", s))
-                    .collect::<Vec<_>>()
-                    .join("\n")
-            )
+            "Didn't see a test file for the following files:\n\n{}\n",
+            missing_files
+                .iter()
+                .map(|s| format!("\t{}", s))
+                .collect::<Vec<_>>()
+                .join("\n")
         );
     }
 }
diff --git a/src/tools/clippy/tests/ui/assertions_on_constants.rs b/src/tools/clippy/tests/ui/assertions_on_constants.rs
index 60d721c2f20..e989de65404 100644
--- a/src/tools/clippy/tests/ui/assertions_on_constants.rs
+++ b/src/tools/clippy/tests/ui/assertions_on_constants.rs
@@ -1,3 +1,5 @@
+#![allow(non_fmt_panic)]
+
 macro_rules! assert_const {
     ($len:expr) => {
         assert!($len > 0);
diff --git a/src/tools/clippy/tests/ui/assertions_on_constants.stderr b/src/tools/clippy/tests/ui/assertions_on_constants.stderr
index 8f09c8ce9d5..c66fdf093f5 100644
--- a/src/tools/clippy/tests/ui/assertions_on_constants.stderr
+++ b/src/tools/clippy/tests/ui/assertions_on_constants.stderr
@@ -1,5 +1,5 @@
 error: `assert!(true)` will be optimized out by the compiler
-  --> $DIR/assertions_on_constants.rs:9:5
+  --> $DIR/assertions_on_constants.rs:11:5
    |
 LL |     assert!(true);
    |     ^^^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL |     assert!(true);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(false)` should probably be replaced
-  --> $DIR/assertions_on_constants.rs:10:5
+  --> $DIR/assertions_on_constants.rs:12:5
    |
 LL |     assert!(false);
    |     ^^^^^^^^^^^^^^^
@@ -18,7 +18,7 @@ LL |     assert!(false);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(true)` will be optimized out by the compiler
-  --> $DIR/assertions_on_constants.rs:11:5
+  --> $DIR/assertions_on_constants.rs:13:5
    |
 LL |     assert!(true, "true message");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -27,7 +27,7 @@ LL |     assert!(true, "true message");
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(false, "false message")` should probably be replaced
-  --> $DIR/assertions_on_constants.rs:12:5
+  --> $DIR/assertions_on_constants.rs:14:5
    |
 LL |     assert!(false, "false message");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -36,7 +36,7 @@ LL |     assert!(false, "false message");
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(false, msg.to_uppercase())` should probably be replaced
-  --> $DIR/assertions_on_constants.rs:15:5
+  --> $DIR/assertions_on_constants.rs:17:5
    |
 LL |     assert!(false, msg.to_uppercase());
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,7 +45,7 @@ LL |     assert!(false, msg.to_uppercase());
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(true)` will be optimized out by the compiler
-  --> $DIR/assertions_on_constants.rs:18:5
+  --> $DIR/assertions_on_constants.rs:20:5
    |
 LL |     assert!(B);
    |     ^^^^^^^^^^^
@@ -54,7 +54,7 @@ LL |     assert!(B);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(false)` should probably be replaced
-  --> $DIR/assertions_on_constants.rs:21:5
+  --> $DIR/assertions_on_constants.rs:23:5
    |
 LL |     assert!(C);
    |     ^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL |     assert!(C);
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `assert!(false, "C message")` should probably be replaced
-  --> $DIR/assertions_on_constants.rs:22:5
+  --> $DIR/assertions_on_constants.rs:24:5
    |
 LL |     assert!(C, "C message");
    |     ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -72,7 +72,7 @@ LL |     assert!(C, "C message");
    = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: `debug_assert!(true)` will be optimized out by the compiler
-  --> $DIR/assertions_on_constants.rs:24:5
+  --> $DIR/assertions_on_constants.rs:26:5
    |
 LL |     debug_assert!(true);
    |     ^^^^^^^^^^^^^^^^^^^^
diff --git a/src/tools/clippy/tests/ui/fallible_impl_from.rs b/src/tools/clippy/tests/ui/fallible_impl_from.rs
index 679f4a7dc35..5d5af4e4632 100644
--- a/src/tools/clippy/tests/ui/fallible_impl_from.rs
+++ b/src/tools/clippy/tests/ui/fallible_impl_from.rs
@@ -36,7 +36,7 @@ impl From<Option<String>> for Invalid {
     fn from(s: Option<String>) -> Invalid {
         let s = s.unwrap();
         if !s.is_empty() {
-            panic!(42);
+            panic!("42");
         } else if s.parse::<u32>().unwrap() != 42 {
             panic!("{:?}", s);
         }
diff --git a/src/tools/clippy/tests/ui/fallible_impl_from.stderr b/src/tools/clippy/tests/ui/fallible_impl_from.stderr
index ab976b947b3..f787b30bdab 100644
--- a/src/tools/clippy/tests/ui/fallible_impl_from.stderr
+++ b/src/tools/clippy/tests/ui/fallible_impl_from.stderr
@@ -59,8 +59,8 @@ note: potential failure(s)
 LL |         let s = s.unwrap();
    |                 ^^^^^^^^^^
 LL |         if !s.is_empty() {
-LL |             panic!(42);
-   |             ^^^^^^^^^^^
+LL |             panic!("42");
+   |             ^^^^^^^^^^^^^
 LL |         } else if s.parse::<u32>().unwrap() != 42 {
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^
 LL |             panic!("{:?}", s);