Skip to content

Commit af2dcee

Browse files
committed
Bump ui_test version
1 parent 3b36b37 commit af2dcee

File tree

159 files changed

+935
-922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+935
-922
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ color-print = "0.3.4"
3030
anstream = "0.5.0"
3131

3232
[dev-dependencies]
33-
ui_test = "0.21.2"
33+
ui_test = "0.22"
3434
tester = "0.9"
3535
regex = "1.5"
3636
toml = "0.7.3"

tests/compile-test.rs

+24-17
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
#![warn(rust_2018_idioms, unused_lifetimes)]
55
#![allow(unused_extern_crates)]
66

7-
use ui_test::{status_emitter, Args, CommandBuilder, Config, Match, Mode, OutputConflictHandling};
7+
use ui_test::spanned::Spanned;
8+
use ui_test::{status_emitter, Args, CommandBuilder, Config, Match, Mode};
89

910
use std::collections::BTreeMap;
1011
use std::env::{self, set_var, var_os};
@@ -112,20 +113,21 @@ fn base_config(test_dir: &str) -> (Config, Args) {
112113

113114
let target_dir = PathBuf::from(var_os("CARGO_TARGET_DIR").unwrap_or_else(|| "target".into()));
114115
let mut config = Config {
115-
mode: Mode::Yolo {
116-
rustfix: ui_test::RustfixMode::Everything,
117-
},
118116
filter_files: env::var("TESTNAME")
119117
.map(|filters| filters.split(',').map(str::to_string).collect())
120118
.unwrap_or_default(),
121119
target: None,
120+
bless_command: Some("cargo uibless".into()),
122121
out_dir: target_dir.join("ui_test"),
123122
..Config::rustc(Path::new("tests").join(test_dir))
124123
};
125-
config.with_args(&args, /* bless by default */ false);
126-
if let OutputConflictHandling::Error(err) = &mut config.output_conflict_handling {
127-
*err = "cargo uibless".into();
128-
}
124+
config.comment_defaults.base().mode = Some(Spanned::dummy(Mode::Yolo {
125+
rustfix: ui_test::RustfixMode::Everything,
126+
}))
127+
.into();
128+
config.comment_defaults.base().diagnostic_code_prefix = Some(Spanned::dummy("clippy::".into())).into();
129+
config.filter(&format!("tests/{test_dir}"), "$$DIR");
130+
config.with_args(&args);
129131
let current_exe_path = env::current_exe().unwrap();
130132
let deps_path = current_exe_path.parent().unwrap();
131133
let profile_path = deps_path.parent().unwrap();
@@ -179,9 +181,7 @@ fn run_internal_tests() {
179181
return;
180182
}
181183
let (mut config, args) = base_config("ui-internal");
182-
if let OutputConflictHandling::Error(err) = &mut config.output_conflict_handling {
183-
*err = "cargo uitest --features internal -- -- --bless".into();
184-
}
184+
config.bless_command = Some("cargo uitest --features internal -- -- --bless".into());
185185

186186
ui_test::run_tests_generic(
187187
vec![config],
@@ -196,8 +196,10 @@ fn run_ui_toml() {
196196
let (mut config, args) = base_config("ui-toml");
197197

198198
config
199-
.stderr_filters
200-
.push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR"));
199+
.comment_defaults
200+
.base()
201+
.normalize_stderr
202+
.push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR".into()));
201203

202204
ui_test::run_tests_generic(
203205
vec![config],
@@ -213,6 +215,8 @@ fn run_ui_toml() {
213215
.unwrap();
214216
}
215217

218+
// Allow `Default::default` as `OptWithSpan` is not nameable
219+
#[allow(clippy::default_trait_access)]
216220
fn run_ui_cargo() {
217221
if IS_RUSTC_TEST_SUITE {
218222
return;
@@ -234,11 +238,13 @@ fn run_ui_cargo() {
234238
} else {
235239
"cargo-clippy"
236240
});
237-
config.edition = None;
241+
config.comment_defaults.base().edition = Default::default();
238242

239243
config
240-
.stderr_filters
241-
.push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR"));
244+
.comment_defaults
245+
.base()
246+
.normalize_stderr
247+
.push((Match::from(env::current_dir().unwrap().as_path()), b"$DIR".into()));
242248

243249
let ignored_32bit = |path: &Path| {
244250
// FIXME: for some reason the modules are linted in a different order for this test
@@ -248,7 +254,8 @@ fn run_ui_cargo() {
248254
ui_test::run_tests_generic(
249255
vec![config],
250256
|path, config| {
251-
path.ends_with("Cargo.toml") && ui_test::default_any_file_filter(path, config) && !ignored_32bit(path)
257+
path.ends_with("Cargo.toml")
258+
.then(|| ui_test::default_any_file_filter(path, config) && !ignored_32bit(path))
252259
},
253260
|_config, _path, _file_contents| {},
254261
status_emitter::Text::from(args.format),
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
warning: using config file `$DIR/$DIR/.clippy.toml`, `$DIR/$DIR/clippy.toml` will be ignored
1+
warning: using config file `$DIR/$DIR/multiple_config_files/warn/.clippy.toml`, `$DIR/$DIR/multiple_config_files/warn/clippy.toml` will be ignored
22

tests/ui-toml/absolute_paths/absolute_paths.allow_crates.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: consider bringing this path into scope with the `use` keyword
2-
--> $DIR/absolute_paths.rs:40:5
2+
--> $DIR/absolute_paths/absolute_paths.rs:40:5
33
|
44
LL | std::f32::MAX;
55
| ^^^^^^^^^^^^^
@@ -8,19 +8,19 @@ LL | std::f32::MAX;
88
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
99

1010
error: consider bringing this path into scope with the `use` keyword
11-
--> $DIR/absolute_paths.rs:41:5
11+
--> $DIR/absolute_paths/absolute_paths.rs:41:5
1212
|
1313
LL | core::f32::MAX;
1414
| ^^^^^^^^^^^^^^
1515

1616
error: consider bringing this path into scope with the `use` keyword
17-
--> $DIR/absolute_paths.rs:42:5
17+
--> $DIR/absolute_paths/absolute_paths.rs:42:5
1818
|
1919
LL | ::core::f32::MAX;
2020
| ^^^^^^^^^^^^^^^^
2121

2222
error: consider bringing this path into scope with the `use` keyword
23-
--> $DIR/absolute_paths.rs:58:5
23+
--> $DIR/absolute_paths/absolute_paths.rs:58:5
2424
|
2525
LL | ::std::f32::MAX;
2626
| ^^^^^^^^^^^^^^^

tests/ui-toml/absolute_paths/absolute_paths.disallow_crates.stderr

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: consider bringing this path into scope with the `use` keyword
2-
--> $DIR/absolute_paths.rs:40:5
2+
--> $DIR/absolute_paths/absolute_paths.rs:40:5
33
|
44
LL | std::f32::MAX;
55
| ^^^^^^^^^^^^^
@@ -8,61 +8,61 @@ LL | std::f32::MAX;
88
= help: to override `-D warnings` add `#[allow(clippy::absolute_paths)]`
99

1010
error: consider bringing this path into scope with the `use` keyword
11-
--> $DIR/absolute_paths.rs:41:5
11+
--> $DIR/absolute_paths/absolute_paths.rs:41:5
1212
|
1313
LL | core::f32::MAX;
1414
| ^^^^^^^^^^^^^^
1515

1616
error: consider bringing this path into scope with the `use` keyword
17-
--> $DIR/absolute_paths.rs:42:5
17+
--> $DIR/absolute_paths/absolute_paths.rs:42:5
1818
|
1919
LL | ::core::f32::MAX;
2020
| ^^^^^^^^^^^^^^^^
2121

2222
error: consider bringing this path into scope with the `use` keyword
23-
--> $DIR/absolute_paths.rs:43:5
23+
--> $DIR/absolute_paths/absolute_paths.rs:43:5
2424
|
2525
LL | crate::a::b::c::C;
2626
| ^^^^^^^^^^^^^^^^^
2727

2828
error: consider bringing this path into scope with the `use` keyword
29-
--> $DIR/absolute_paths.rs:44:5
29+
--> $DIR/absolute_paths/absolute_paths.rs:44:5
3030
|
3131
LL | crate::a::b::c::d::e::f::F;
3232
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
3333

3434
error: consider bringing this path into scope with the `use` keyword
35-
--> $DIR/absolute_paths.rs:45:5
35+
--> $DIR/absolute_paths/absolute_paths.rs:45:5
3636
|
3737
LL | crate::a::A;
3838
| ^^^^^^^^^^^
3939

4040
error: consider bringing this path into scope with the `use` keyword
41-
--> $DIR/absolute_paths.rs:46:5
41+
--> $DIR/absolute_paths/absolute_paths.rs:46:5
4242
|
4343
LL | crate::a::b::B;
4444
| ^^^^^^^^^^^^^^
4545

4646
error: consider bringing this path into scope with the `use` keyword
47-
--> $DIR/absolute_paths.rs:47:5
47+
--> $DIR/absolute_paths/absolute_paths.rs:47:5
4848
|
4949
LL | crate::a::b::c::C::ZERO;
5050
| ^^^^^^^^^^^^^^^^^
5151

5252
error: consider bringing this path into scope with the `use` keyword
53-
--> $DIR/absolute_paths.rs:48:5
53+
--> $DIR/absolute_paths/absolute_paths.rs:48:5
5454
|
5555
LL | helper::b::c::d::e::f();
5656
| ^^^^^^^^^^^^^^^^^^^^^
5757

5858
error: consider bringing this path into scope with the `use` keyword
59-
--> $DIR/absolute_paths.rs:49:5
59+
--> $DIR/absolute_paths/absolute_paths.rs:49:5
6060
|
6161
LL | ::helper::b::c::d::e::f();
6262
| ^^^^^^^^^^^^^^^^^^^^^^^
6363

6464
error: consider bringing this path into scope with the `use` keyword
65-
--> $DIR/absolute_paths.rs:58:5
65+
--> $DIR/absolute_paths/absolute_paths.rs:58:5
6666
|
6767
LL | ::std::f32::MAX;
6868
| ^^^^^^^^^^^^^^^

tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: variables can be used directly in the `format!` string
2-
--> $DIR/uninlined_format_args.rs:9:5
2+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:9:5
33
|
44
LL | println!("val='{}'", local_i32);
55
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -13,7 +13,7 @@ LL + println!("val='{local_i32}'");
1313
|
1414

1515
error: variables can be used directly in the `format!` string
16-
--> $DIR/uninlined_format_args.rs:10:5
16+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:10:5
1717
|
1818
LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -25,7 +25,7 @@ LL + println!("Hello {} is {local_f64:.local_i32$}", "x");
2525
|
2626

2727
error: literal with an empty format string
28-
--> $DIR/uninlined_format_args.rs:10:35
28+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:10:35
2929
|
3030
LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
3131
| ^^^
@@ -39,7 +39,7 @@ LL + println!("Hello x is {:.*}", local_i32, local_f64);
3939
|
4040

4141
error: variables can be used directly in the `format!` string
42-
--> $DIR/uninlined_format_args.rs:11:5
42+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:11:5
4343
|
4444
LL | println!("Hello {} is {:.*}", local_i32, 5, local_f64);
4545
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -51,7 +51,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
5151
|
5252

5353
error: variables can be used directly in the `format!` string
54-
--> $DIR/uninlined_format_args.rs:12:5
54+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:12:5
5555
|
5656
LL | println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
5757
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -63,7 +63,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
6363
|
6464

6565
error: variables can be used directly in the `format!` string
66-
--> $DIR/uninlined_format_args.rs:13:5
66+
--> $DIR/allow_mixed_uninlined_format_args/uninlined_format_args.rs:13:5
6767
|
6868
LL | println!("{}, {}", local_i32, local_opt.unwrap());
6969
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

tests/ui-toml/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: arithmetic operation that can potentially result in unexpected side-effects
2-
--> $DIR/arithmetic_side_effects_allowed.rs:69:13
2+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:69:13
33
|
44
LL | let _ = Baz + Baz;
55
| ^^^^^^^^^
@@ -8,49 +8,49 @@ LL | let _ = Baz + Baz;
88
= help: to override `-D warnings` add `#[allow(clippy::arithmetic_side_effects)]`
99

1010
error: arithmetic operation that can potentially result in unexpected side-effects
11-
--> $DIR/arithmetic_side_effects_allowed.rs:80:13
11+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:80:13
1212
|
1313
LL | let _ = 1i32 + Baz;
1414
| ^^^^^^^^^^
1515

1616
error: arithmetic operation that can potentially result in unexpected side-effects
17-
--> $DIR/arithmetic_side_effects_allowed.rs:83:13
17+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:83:13
1818
|
1919
LL | let _ = 1i64 + Foo;
2020
| ^^^^^^^^^^
2121

2222
error: arithmetic operation that can potentially result in unexpected side-effects
23-
--> $DIR/arithmetic_side_effects_allowed.rs:87:13
23+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:87:13
2424
|
2525
LL | let _ = 1i64 + Baz;
2626
| ^^^^^^^^^^
2727

2828
error: arithmetic operation that can potentially result in unexpected side-effects
29-
--> $DIR/arithmetic_side_effects_allowed.rs:98:13
29+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:98:13
3030
|
3131
LL | let _ = Baz + 1i32;
3232
| ^^^^^^^^^^
3333

3434
error: arithmetic operation that can potentially result in unexpected side-effects
35-
--> $DIR/arithmetic_side_effects_allowed.rs:101:13
35+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:101:13
3636
|
3737
LL | let _ = Foo + 1i64;
3838
| ^^^^^^^^^^
3939

4040
error: arithmetic operation that can potentially result in unexpected side-effects
41-
--> $DIR/arithmetic_side_effects_allowed.rs:105:13
41+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:105:13
4242
|
4343
LL | let _ = Baz + 1i64;
4444
| ^^^^^^^^^^
4545

4646
error: arithmetic operation that can potentially result in unexpected side-effects
47-
--> $DIR/arithmetic_side_effects_allowed.rs:114:13
47+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:114:13
4848
|
4949
LL | let _ = -Bar;
5050
| ^^^^
5151

5252
error: arithmetic operation that can potentially result in unexpected side-effects
53-
--> $DIR/arithmetic_side_effects_allowed.rs:116:13
53+
--> $DIR/arithmetic_side_effects_allowed/arithmetic_side_effects_allowed.rs:116:13
5454
|
5555
LL | let _ = -Baz;
5656
| ^^^^

tests/ui-toml/array_size_threshold/array_size_threshold.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: large array defined as const
2-
--> $DIR/array_size_threshold.rs:4:1
2+
--> $DIR/array_size_threshold/array_size_threshold.rs:4:1
33
|
44
LL | const ABOVE: [u8; 11] = [0; 11];
55
| -----^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -10,7 +10,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
1010
= help: to override `-D warnings` add `#[allow(clippy::large_const_arrays)]`
1111

1212
error: allocating a local array larger than 10 bytes
13-
--> $DIR/array_size_threshold.rs:4:25
13+
--> $DIR/array_size_threshold/array_size_threshold.rs:4:25
1414
|
1515
LL | const ABOVE: [u8; 11] = [0; 11];
1616
| ^^^^^^^
@@ -20,7 +20,7 @@ LL | const ABOVE: [u8; 11] = [0; 11];
2020
= help: to override `-D warnings` add `#[allow(clippy::large_stack_arrays)]`
2121

2222
error: allocating a local array larger than 10 bytes
23-
--> $DIR/array_size_threshold.rs:8:17
23+
--> $DIR/array_size_threshold/array_size_threshold.rs:8:17
2424
|
2525
LL | let above = [0u8; 11];
2626
| ^^^^^^^^^

tests/ui-toml/await_holding_invalid_type/await_holding_invalid_type.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
2-
--> $DIR/await_holding_invalid_type.rs:5:9
2+
--> $DIR/await_holding_invalid_type/await_holding_invalid_type.rs:5:9
33
|
44
LL | let _x = String::from("hello");
55
| ^^
@@ -9,13 +9,13 @@ LL | let _x = String::from("hello");
99
= help: to override `-D warnings` add `#[allow(clippy::await_holding_invalid_type)]`
1010

1111
error: `std::net::Ipv4Addr` may not be held across an `await` point per `clippy.toml`
12-
--> $DIR/await_holding_invalid_type.rs:10:9
12+
--> $DIR/await_holding_invalid_type/await_holding_invalid_type.rs:10:9
1313
|
1414
LL | let x = Ipv4Addr::new(127, 0, 0, 1);
1515
| ^
1616

1717
error: `std::string::String` may not be held across an `await` point per `clippy.toml`
18-
--> $DIR/await_holding_invalid_type.rs:33:13
18+
--> $DIR/await_holding_invalid_type/await_holding_invalid_type.rs:33:13
1919
|
2020
LL | let _x = String::from("hi!");
2121
| ^^

tests/ui-toml/bad_toml/conf_bad_toml.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: error reading Clippy's configuration file: expected `.`, `=`
2-
--> $DIR/$DIR/clippy.toml:1:4
2+
--> $DIR/$DIR/bad_toml/clippy.toml:1:4
33
|
44
LL | fn this_is_obviously(not: a, toml: file) {
55
| ^

tests/ui-toml/bad_toml_type/conf_bad_type.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: error reading Clippy's configuration file: invalid type: integer `42`, expected a sequence
2-
--> $DIR/$DIR/clippy.toml:1:20
2+
--> $DIR/$DIR/bad_toml_type/clippy.toml:1:20
33
|
44
LL | disallowed-names = 42
55
| ^^

0 commit comments

Comments
 (0)