Skip to content

Commit 702ba71

Browse files
committed
Port usages of revision and edition flags to ui_test
1 parent 234db5c commit 702ba71

31 files changed

+280
-501
lines changed

tests/compile-test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ fn base_config(test_dir: &str) -> compiletest::Config {
3737
out_dir: Some("target/ui_test".into()),
3838
..compiletest::Config::default()
3939
};
40-
config.args.push("--edition=2021".into());
4140

4241
if let Ok(filters) = env::var("TESTNAME") {
4342
config.path_filter = filters.split(',').map(ToString::to_string).collect();
@@ -117,6 +116,7 @@ fn run_ui_cargo() {
117116
];
118117
config.program = "cargo".into();
119118
config.out_dir = None;
119+
config.edition = None;
120120

121121
config.stderr_filter("in ([0-9]m )?[0-9\\.]+s", "");
122122
config.stdout_filter("in ([0-9]m )?[0-9\\.]+s", "");

tests/ui-internal/custom_ice_message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// rustc-env:RUST_BACKTRACE=0
1+
//@rustc-env:RUST_BACKTRACE=0
22
//@normalize-stderr-test: "Clippy version: .*" -> "Clippy version: foo"
33
//@normalize-stderr-test: "produce_ice.rs:\d*:\d*" -> "produce_ice.rs"
44
//@normalize-stderr-test: "', .*clippy_lints" -> "', clippy_lints"

tests/ui/almost_complete_range.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33
//@aux-build:macro_rules.rs
44

55
#![feature(exclusive_range_pattern)]

tests/ui/almost_complete_range.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33
//@aux-build:macro_rules.rs
44

55
#![feature(exclusive_range_pattern)]

tests/ui/author/blocks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// edition:2018
1+
//@edition:2018
22

33
#![allow(redundant_semicolons, clippy::no_effect)]
44
#![feature(stmt_expr_attributes)]

tests/ui/manual_assert.edition2018.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// revisions: edition2018 edition2021
2-
//[edition2018] edition:2018
3-
//[edition2021] edition:2021
1+
//@revisions: edition2018 edition2021
2+
//@[edition2018] edition:2018
3+
//@[edition2021] edition:2021
44
//@run-rustfix
55

66
#![warn(clippy::manual_assert)]

tests/ui/manual_assert.edition2021.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// revisions: edition2018 edition2021
2-
//[edition2018] edition:2018
3-
//[edition2021] edition:2021
1+
//@revisions: edition2018 edition2021
2+
//@[edition2018] edition:2018
3+
//@[edition2021] edition:2021
44
//@run-rustfix
55

66
#![warn(clippy::manual_assert)]
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
warning: only a `panic!` in `if`-then statement
2+
--> $DIR/manual_assert.rs:31:5
3+
|
4+
LL | / if !a.is_empty() {
5+
LL | | panic!("qaqaq{:?}", a);
6+
LL | | }
7+
| |_____^ help: try instead: `assert!(a.is_empty(), "qaqaq{:?}", a);`
8+
|
9+
note: the lint level is defined here
10+
--> $DIR/manual_assert.rs:6:9
11+
|
12+
LL | #![warn(clippy::manual_assert)]
13+
| ^^^^^^^^^^^^^^^^^^^^^
14+
15+
warning: only a `panic!` in `if`-then statement
16+
--> $DIR/manual_assert.rs:34:5
17+
|
18+
LL | / if !a.is_empty() {
19+
LL | | panic!("qwqwq");
20+
LL | | }
21+
| |_____^ help: try instead: `assert!(a.is_empty(), "qwqwq");`
22+
23+
warning: only a `panic!` in `if`-then statement
24+
--> $DIR/manual_assert.rs:51:5
25+
|
26+
LL | / if b.is_empty() {
27+
LL | | panic!("panic1");
28+
LL | | }
29+
| |_____^ help: try instead: `assert!(!b.is_empty(), "panic1");`
30+
31+
warning: only a `panic!` in `if`-then statement
32+
--> $DIR/manual_assert.rs:54:5
33+
|
34+
LL | / if b.is_empty() && a.is_empty() {
35+
LL | | panic!("panic2");
36+
LL | | }
37+
| |_____^ help: try instead: `assert!(!(b.is_empty() && a.is_empty()), "panic2");`
38+
39+
warning: only a `panic!` in `if`-then statement
40+
--> $DIR/manual_assert.rs:57:5
41+
|
42+
LL | / if a.is_empty() && !b.is_empty() {
43+
LL | | panic!("panic3");
44+
LL | | }
45+
| |_____^ help: try instead: `assert!(!(a.is_empty() && !b.is_empty()), "panic3");`
46+
47+
warning: only a `panic!` in `if`-then statement
48+
--> $DIR/manual_assert.rs:60:5
49+
|
50+
LL | / if b.is_empty() || a.is_empty() {
51+
LL | | panic!("panic4");
52+
LL | | }
53+
| |_____^ help: try instead: `assert!(!(b.is_empty() || a.is_empty()), "panic4");`
54+
55+
warning: only a `panic!` in `if`-then statement
56+
--> $DIR/manual_assert.rs:63:5
57+
|
58+
LL | / if a.is_empty() || !b.is_empty() {
59+
LL | | panic!("panic5");
60+
LL | | }
61+
| |_____^ help: try instead: `assert!(!(a.is_empty() || !b.is_empty()), "panic5");`
62+
63+
warning: only a `panic!` in `if`-then statement
64+
--> $DIR/manual_assert.rs:66:5
65+
|
66+
LL | / if a.is_empty() {
67+
LL | | panic!("with expansion {}", one!())
68+
LL | | }
69+
| |_____^ help: try instead: `assert!(!a.is_empty(), "with expansion {}", one!());`
70+
71+
warning: only a `panic!` in `if`-then statement
72+
--> $DIR/manual_assert.rs:78:5
73+
|
74+
LL | / if a > 2 {
75+
LL | | // comment
76+
LL | | /* this is a
77+
LL | | multiline
78+
... |
79+
LL | | panic!("panic with comment") // comment after `panic!`
80+
LL | | }
81+
| |_____^
82+
|
83+
help: try instead
84+
|
85+
LL | assert!(!(a > 2), "panic with comment");
86+
|
87+
88+
warning: 9 warnings emitted
89+

tests/ui/manual_assert.fixed

Lines changed: 0 additions & 69 deletions
This file was deleted.

tests/ui/manual_assert.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// revisions: edition2018 edition2021
2-
//[edition2018] edition:2018
3-
//[edition2021] edition:2021
1+
//@revisions: edition2018 edition2021
2+
//@[edition2018] edition:2018
3+
//@[edition2021] edition:2021
44
//@run-rustfix
55

66
#![warn(clippy::manual_assert)]

tests/ui/must_use_unit.fixed

Lines changed: 0 additions & 26 deletions
This file was deleted.

tests/ui/needless_parens_on_range_literals.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33

44
#![warn(clippy::needless_parens_on_range_literals)]
55
#![allow(clippy::almost_complete_range)]

tests/ui/needless_parens_on_range_literals.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33

44
#![warn(clippy::needless_parens_on_range_literals)]
55
#![allow(clippy::almost_complete_range)]

tests/ui/needless_splitn.fixed

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33

44
#![warn(clippy::needless_splitn)]
55
#![allow(clippy::iter_skip_next, clippy::iter_nth_zero, clippy::manual_split_once)]

tests/ui/needless_splitn.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//@run-rustfix
2-
// edition:2018
2+
//@edition:2018
33

44
#![warn(clippy::needless_splitn)]
55
#![allow(clippy::iter_skip_next, clippy::iter_nth_zero, clippy::manual_split_once)]

tests/ui/no_mangle_with_rust_abi.fixed

Lines changed: 0 additions & 48 deletions
This file was deleted.

tests/ui/numbered_fields.fixed

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/ui/to_digit_is_some.fixed

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/ui/uninlined_format_args_panic.edition2018.fixed

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
// revisions: edition2018 edition2021
2-
//[edition2018] edition:2018
3-
//[edition2021] edition:2021
1+
//@revisions: edition2018 edition2021
2+
//@[edition2018] edition:2018
3+
//@[edition2021] edition:2021
44
//@run-rustfix
55

66
#![warn(clippy::uninlined_format_args)]

0 commit comments

Comments
 (0)