Fix edition revision ui tests
This commit is contained in:
parent
42bdfa23d3
commit
124caeb9a2
@ -1,6 +1,6 @@
|
|||||||
// revisions: edition2018 edition2021
|
// revisions: edition2018 edition2021
|
||||||
// [edition2018] edition:2018
|
//[edition2018] edition:2018
|
||||||
// [edition2021] edition:2021
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
|
||||||
#![warn(clippy::manual_assert)]
|
#![warn(clippy::manual_assert)]
|
||||||
@ -29,7 +29,9 @@ fn main() {
|
|||||||
panic!("qaqaq{:?}", a);
|
panic!("qaqaq{:?}", a);
|
||||||
}
|
}
|
||||||
assert!(a.is_empty(), "qaqaq{:?}", a);
|
assert!(a.is_empty(), "qaqaq{:?}", a);
|
||||||
assert!(a.is_empty(), "qwqwq");
|
if !a.is_empty() {
|
||||||
|
panic!("qwqwq");
|
||||||
|
}
|
||||||
if a.len() == 3 {
|
if a.len() == 3 {
|
||||||
println!("qwq");
|
println!("qwq");
|
||||||
println!("qwq");
|
println!("qwq");
|
||||||
@ -44,21 +46,32 @@ fn main() {
|
|||||||
println!("qwq");
|
println!("qwq");
|
||||||
}
|
}
|
||||||
let b = vec![1, 2, 3];
|
let b = vec![1, 2, 3];
|
||||||
assert!(!b.is_empty(), "panic1");
|
if b.is_empty() {
|
||||||
assert!(!(b.is_empty() && a.is_empty()), "panic2");
|
panic!("panic1");
|
||||||
assert!(!(a.is_empty() && !b.is_empty()), "panic3");
|
}
|
||||||
assert!(!(b.is_empty() || a.is_empty()), "panic4");
|
if b.is_empty() && a.is_empty() {
|
||||||
assert!(!(a.is_empty() || !b.is_empty()), "panic5");
|
panic!("panic2");
|
||||||
|
}
|
||||||
|
if a.is_empty() && !b.is_empty() {
|
||||||
|
panic!("panic3");
|
||||||
|
}
|
||||||
|
if b.is_empty() || a.is_empty() {
|
||||||
|
panic!("panic4");
|
||||||
|
}
|
||||||
|
if a.is_empty() || !b.is_empty() {
|
||||||
|
panic!("panic5");
|
||||||
|
}
|
||||||
assert!(!a.is_empty(), "with expansion {}", one!());
|
assert!(!a.is_empty(), "with expansion {}", one!());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn issue7730(a: u8) {
|
fn issue7730(a: u8) {
|
||||||
// Suggestion should preserve comment
|
// Suggestion should preserve comment
|
||||||
// comment
|
if a > 2 {
|
||||||
/* this is a
|
// comment
|
||||||
|
/* this is a
|
||||||
multiline
|
multiline
|
||||||
comment */
|
comment */
|
||||||
/// Doc comment
|
/// Doc comment
|
||||||
// comment after `panic!`
|
panic!("panic with comment") // comment after `panic!`
|
||||||
assert!(!(a > 2), "panic with comment");
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,84 +12,6 @@ help: try instead
|
|||||||
LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|
LL | assert!(a.is_empty(), "qaqaq{:?}", a);
|
||||||
|
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:34:5
|
|
||||||
|
|
|
||||||
LL | / if !a.is_empty() {
|
|
||||||
LL | | panic!("qwqwq");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(a.is_empty(), "qwqwq");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:51:5
|
|
||||||
|
|
|
||||||
LL | / if b.is_empty() {
|
|
||||||
LL | | panic!("panic1");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!b.is_empty(), "panic1");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:54:5
|
|
||||||
|
|
|
||||||
LL | / if b.is_empty() && a.is_empty() {
|
|
||||||
LL | | panic!("panic2");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!(b.is_empty() && a.is_empty()), "panic2");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:57:5
|
|
||||||
|
|
|
||||||
LL | / if a.is_empty() && !b.is_empty() {
|
|
||||||
LL | | panic!("panic3");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!(a.is_empty() && !b.is_empty()), "panic3");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:60:5
|
|
||||||
|
|
|
||||||
LL | / if b.is_empty() || a.is_empty() {
|
|
||||||
LL | | panic!("panic4");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!(b.is_empty() || a.is_empty()), "panic4");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
|
||||||
--> $DIR/manual_assert.rs:63:5
|
|
||||||
|
|
|
||||||
LL | / if a.is_empty() || !b.is_empty() {
|
|
||||||
LL | | panic!("panic5");
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!(a.is_empty() || !b.is_empty()), "panic5");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
error: only a `panic!` in `if`-then statement
|
||||||
--> $DIR/manual_assert.rs:66:5
|
--> $DIR/manual_assert.rs:66:5
|
||||||
|
|
|
|
||||||
@ -103,22 +25,5 @@ help: try instead
|
|||||||
LL | assert!(!a.is_empty(), "with expansion {}", one!());
|
LL | assert!(!a.is_empty(), "with expansion {}", one!());
|
||||||
|
|
|
|
||||||
|
|
||||||
error: only a `panic!` in `if`-then statement
|
error: aborting due to 2 previous errors
|
||||||
--> $DIR/manual_assert.rs:73:5
|
|
||||||
|
|
|
||||||
LL | / if a > 2 {
|
|
||||||
LL | | // comment
|
|
||||||
LL | | /* this is a
|
|
||||||
LL | | multiline
|
|
||||||
... |
|
|
||||||
LL | | panic!("panic with comment") // comment after `panic!`
|
|
||||||
LL | | }
|
|
||||||
| |_____^
|
|
||||||
|
|
|
||||||
help: try instead
|
|
||||||
|
|
|
||||||
LL | assert!(!(a > 2), "panic with comment");
|
|
||||||
|
|
|
||||||
|
|
||||||
error: aborting due to 9 previous errors
|
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// revisions: edition2018 edition2021
|
// revisions: edition2018 edition2021
|
||||||
// [edition2018] edition:2018
|
//[edition2018] edition:2018
|
||||||
// [edition2021] edition:2021
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
|
||||||
#![warn(clippy::manual_assert)]
|
#![warn(clippy::manual_assert)]
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
// revisions: edition2018 edition2021
|
// revisions: edition2018 edition2021
|
||||||
// [edition2018] edition:2018
|
//[edition2018] edition:2018
|
||||||
// [edition2021] edition:2021
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
|
|
||||||
#![warn(clippy::manual_assert)]
|
#![warn(clippy::manual_assert)]
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
error: `Err(_)` matches all errors
|
|
||||||
--> $DIR/match_wild_err_arm.rs:14:9
|
|
||||||
|
|
|
||||||
LL | Err(_) => panic!("err"),
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
|
||||||
= note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
|
|
||||||
|
|
||||||
error: `Err(_)` matches all errors
|
|
||||||
--> $DIR/match_wild_err_arm.rs:20:9
|
|
||||||
|
|
|
||||||
LL | Err(_) => panic!(),
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
|
||||||
|
|
||||||
error: `Err(_)` matches all errors
|
|
||||||
--> $DIR/match_wild_err_arm.rs:26:9
|
|
||||||
|
|
|
||||||
LL | Err(_) => {
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
|
||||||
|
|
||||||
error: `Err(_e)` matches all errors
|
|
||||||
--> $DIR/match_wild_err_arm.rs:34:9
|
|
||||||
|
|
|
||||||
LL | Err(_e) => panic!(),
|
|
||||||
| ^^^^^^^
|
|
||||||
|
|
|
||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
|
||||||
|
|
@ -1,6 +1,3 @@
|
|||||||
// revisions: edition2018 edition2021
|
|
||||||
// [edition2018] edition:2018
|
|
||||||
// [edition2021] edition:2021
|
|
||||||
#![feature(exclusive_range_pattern)]
|
#![feature(exclusive_range_pattern)]
|
||||||
#![allow(clippy::match_same_arms)]
|
#![allow(clippy::match_same_arms)]
|
||||||
#![warn(clippy::match_wild_err_arm)]
|
#![warn(clippy::match_wild_err_arm)]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
error: `Err(_)` matches all errors
|
error: `Err(_)` matches all errors
|
||||||
--> $DIR/match_wild_err_arm.rs:14:9
|
--> $DIR/match_wild_err_arm.rs:11:9
|
||||||
|
|
|
|
||||||
LL | Err(_) => panic!("err"),
|
LL | Err(_) => panic!("err"),
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@ -8,7 +8,7 @@ LL | Err(_) => panic!("err"),
|
|||||||
= note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
|
= note: `-D clippy::match-wild-err-arm` implied by `-D warnings`
|
||||||
|
|
||||||
error: `Err(_)` matches all errors
|
error: `Err(_)` matches all errors
|
||||||
--> $DIR/match_wild_err_arm.rs:20:9
|
--> $DIR/match_wild_err_arm.rs:17:9
|
||||||
|
|
|
|
||||||
LL | Err(_) => panic!(),
|
LL | Err(_) => panic!(),
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@ -16,7 +16,7 @@ LL | Err(_) => panic!(),
|
|||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
||||||
|
|
||||||
error: `Err(_)` matches all errors
|
error: `Err(_)` matches all errors
|
||||||
--> $DIR/match_wild_err_arm.rs:26:9
|
--> $DIR/match_wild_err_arm.rs:23:9
|
||||||
|
|
|
|
||||||
LL | Err(_) => {
|
LL | Err(_) => {
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
@ -24,7 +24,7 @@ LL | Err(_) => {
|
|||||||
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
= note: match each error separately or use the error output, or use `.expect(msg)` if the error case is unreachable
|
||||||
|
|
||||||
error: `Err(_e)` matches all errors
|
error: `Err(_e)` matches all errors
|
||||||
--> $DIR/match_wild_err_arm.rs:34:9
|
--> $DIR/match_wild_err_arm.rs:31:9
|
||||||
|
|
|
|
||||||
LL | Err(_e) => panic!(),
|
LL | Err(_e) => panic!(),
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
@ -1,23 +0,0 @@
|
|||||||
// run-rustfix
|
|
||||||
// edition:2021
|
|
||||||
|
|
||||||
#![warn(clippy::uninlined_format_args)]
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let var = 1;
|
|
||||||
|
|
||||||
println!("val='{}'", var);
|
|
||||||
|
|
||||||
if var > 0 {
|
|
||||||
panic!("p1 {}", var);
|
|
||||||
}
|
|
||||||
if var > 0 {
|
|
||||||
panic!("p2 {0}", var);
|
|
||||||
}
|
|
||||||
if var > 0 {
|
|
||||||
panic!("p3 {var}", var = var);
|
|
||||||
}
|
|
||||||
if var > 0 {
|
|
||||||
panic!("p4 {var}");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,7 @@
|
|||||||
|
// revisions: edition2018 edition2021
|
||||||
|
//[edition2018] edition:2018
|
||||||
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
// edition:2018
|
|
||||||
|
|
||||||
#![warn(clippy::uninlined_format_args)]
|
#![warn(clippy::uninlined_format_args)]
|
||||||
|
|
@ -1,5 +1,5 @@
|
|||||||
error: variables can be used directly in the `format!` string
|
error: variables can be used directly in the `format!` string
|
||||||
--> $DIR/uninlined_format_args_2018.rs:9:5
|
--> $DIR/uninlined_format_args_panic.rs:11:5
|
||||||
|
|
|
|
||||||
LL | println!("val='{}'", var);
|
LL | println!("val='{}'", var);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
@ -1,5 +1,7 @@
|
|||||||
|
// revisions: edition2018 edition2021
|
||||||
|
//[edition2018] edition:2018
|
||||||
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
// edition:2021
|
|
||||||
|
|
||||||
#![warn(clippy::uninlined_format_args)]
|
#![warn(clippy::uninlined_format_args)]
|
||||||
|
|
||||||
@ -17,7 +19,11 @@ fn main() {
|
|||||||
if var > 0 {
|
if var > 0 {
|
||||||
panic!("p3 {var}");
|
panic!("p3 {var}");
|
||||||
}
|
}
|
||||||
if var > 0 {
|
|
||||||
panic!("p4 {var}");
|
#[allow(non_fmt_panics)]
|
||||||
|
{
|
||||||
|
if var > 0 {
|
||||||
|
panic!("p4 {var}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,5 @@
|
|||||||
error: variables can be used directly in the `format!` string
|
error: variables can be used directly in the `format!` string
|
||||||
--> $DIR/uninlined_format_args_2021.rs:9:5
|
--> $DIR/uninlined_format_args_panic.rs:11:5
|
||||||
|
|
|
|
||||||
LL | println!("val='{}'", var);
|
LL | println!("val='{}'", var);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -12,7 +12,7 @@ LL + println!("val='{var}'");
|
|||||||
|
|
|
|
||||||
|
|
||||||
error: variables can be used directly in the `format!` string
|
error: variables can be used directly in the `format!` string
|
||||||
--> $DIR/uninlined_format_args_2021.rs:12:9
|
--> $DIR/uninlined_format_args_panic.rs:14:9
|
||||||
|
|
|
|
||||||
LL | panic!("p1 {}", var);
|
LL | panic!("p1 {}", var);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -24,7 +24,7 @@ LL + panic!("p1 {var}");
|
|||||||
|
|
|
|
||||||
|
|
||||||
error: variables can be used directly in the `format!` string
|
error: variables can be used directly in the `format!` string
|
||||||
--> $DIR/uninlined_format_args_2021.rs:15:9
|
--> $DIR/uninlined_format_args_panic.rs:17:9
|
||||||
|
|
|
|
||||||
LL | panic!("p2 {0}", var);
|
LL | panic!("p2 {0}", var);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^
|
||||||
@ -36,7 +36,7 @@ LL + panic!("p2 {var}");
|
|||||||
|
|
|
|
||||||
|
|
||||||
error: variables can be used directly in the `format!` string
|
error: variables can be used directly in the `format!` string
|
||||||
--> $DIR/uninlined_format_args_2021.rs:18:9
|
--> $DIR/uninlined_format_args_panic.rs:20:9
|
||||||
|
|
|
|
||||||
LL | panic!("p3 {var}", var = var);
|
LL | panic!("p3 {var}", var = var);
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
@ -1,5 +1,7 @@
|
|||||||
|
// revisions: edition2018 edition2021
|
||||||
|
//[edition2018] edition:2018
|
||||||
|
//[edition2021] edition:2021
|
||||||
// run-rustfix
|
// run-rustfix
|
||||||
// edition:2018
|
|
||||||
|
|
||||||
#![warn(clippy::uninlined_format_args)]
|
#![warn(clippy::uninlined_format_args)]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user