Skip to content

Commit 3f3eb89

Browse files
committed
Fix/allow non_fmt_panic in clippy tests.
1 parent 753b0b0 commit 3f3eb89

5 files changed

+20
-20
lines changed

src/tools/clippy/tests/missing-test-files.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,12 @@ fn test_missing_tests() {
99
if !missing_files.is_empty() {
1010
assert!(
1111
false,
12-
format!(
13-
"Didn't see a test file for the following files:\n\n{}\n",
14-
missing_files
15-
.iter()
16-
.map(|s| format!("\t{}", s))
17-
.collect::<Vec<_>>()
18-
.join("\n")
19-
)
12+
"Didn't see a test file for the following files:\n\n{}\n",
13+
missing_files
14+
.iter()
15+
.map(|s| format!("\t{}", s))
16+
.collect::<Vec<_>>()
17+
.join("\n")
2018
);
2119
}
2220
}

src/tools/clippy/tests/ui/assertions_on_constants.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(non_fmt_panic)]
2+
13
macro_rules! assert_const {
24
($len:expr) => {
35
assert!($len > 0);

src/tools/clippy/tests/ui/assertions_on_constants.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `assert!(true)` will be optimized out by the compiler
2-
--> $DIR/assertions_on_constants.rs:9:5
2+
--> $DIR/assertions_on_constants.rs:11:5
33
|
44
LL | assert!(true);
55
| ^^^^^^^^^^^^^^
@@ -9,7 +9,7 @@ LL | assert!(true);
99
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1010

1111
error: `assert!(false)` should probably be replaced
12-
--> $DIR/assertions_on_constants.rs:10:5
12+
--> $DIR/assertions_on_constants.rs:12:5
1313
|
1414
LL | assert!(false);
1515
| ^^^^^^^^^^^^^^^
@@ -18,7 +18,7 @@ LL | assert!(false);
1818
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
1919

2020
error: `assert!(true)` will be optimized out by the compiler
21-
--> $DIR/assertions_on_constants.rs:11:5
21+
--> $DIR/assertions_on_constants.rs:13:5
2222
|
2323
LL | assert!(true, "true message");
2424
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -27,7 +27,7 @@ LL | assert!(true, "true message");
2727
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
2828

2929
error: `assert!(false, "false message")` should probably be replaced
30-
--> $DIR/assertions_on_constants.rs:12:5
30+
--> $DIR/assertions_on_constants.rs:14:5
3131
|
3232
LL | assert!(false, "false message");
3333
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -36,7 +36,7 @@ LL | assert!(false, "false message");
3636
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
3737

3838
error: `assert!(false, msg.to_uppercase())` should probably be replaced
39-
--> $DIR/assertions_on_constants.rs:15:5
39+
--> $DIR/assertions_on_constants.rs:17:5
4040
|
4141
LL | assert!(false, msg.to_uppercase());
4242
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -45,7 +45,7 @@ LL | assert!(false, msg.to_uppercase());
4545
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
4646

4747
error: `assert!(true)` will be optimized out by the compiler
48-
--> $DIR/assertions_on_constants.rs:18:5
48+
--> $DIR/assertions_on_constants.rs:20:5
4949
|
5050
LL | assert!(B);
5151
| ^^^^^^^^^^^
@@ -54,7 +54,7 @@ LL | assert!(B);
5454
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
5555

5656
error: `assert!(false)` should probably be replaced
57-
--> $DIR/assertions_on_constants.rs:21:5
57+
--> $DIR/assertions_on_constants.rs:23:5
5858
|
5959
LL | assert!(C);
6060
| ^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL | assert!(C);
6363
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
6464

6565
error: `assert!(false, "C message")` should probably be replaced
66-
--> $DIR/assertions_on_constants.rs:22:5
66+
--> $DIR/assertions_on_constants.rs:24:5
6767
|
6868
LL | assert!(C, "C message");
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^
@@ -72,7 +72,7 @@ LL | assert!(C, "C message");
7272
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
7373

7474
error: `debug_assert!(true)` will be optimized out by the compiler
75-
--> $DIR/assertions_on_constants.rs:24:5
75+
--> $DIR/assertions_on_constants.rs:26:5
7676
|
7777
LL | debug_assert!(true);
7878
| ^^^^^^^^^^^^^^^^^^^^

src/tools/clippy/tests/ui/fallible_impl_from.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl From<Option<String>> for Invalid {
3636
fn from(s: Option<String>) -> Invalid {
3737
let s = s.unwrap();
3838
if !s.is_empty() {
39-
panic!(42);
39+
panic!("42");
4040
} else if s.parse::<u32>().unwrap() != 42 {
4141
panic!("{:?}", s);
4242
}

src/tools/clippy/tests/ui/fallible_impl_from.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ note: potential failure(s)
5959
LL | let s = s.unwrap();
6060
| ^^^^^^^^^^
6161
LL | if !s.is_empty() {
62-
LL | panic!(42);
63-
| ^^^^^^^^^^^
62+
LL | panic!("42");
63+
| ^^^^^^^^^^^^^
6464
LL | } else if s.parse::<u32>().unwrap() != 42 {
6565
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6666
LL | panic!("{:?}", s);

0 commit comments

Comments
 (0)