Skip to content

Commit

Permalink
Update ui-toml tests
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Feb 15, 2025
1 parent a2c890f commit 3053bad
Show file tree
Hide file tree
Showing 138 changed files with 888 additions and 413 deletions.
14 changes: 0 additions & 14 deletions tests/ui-toml/absolute_paths/absolute_paths_2015.default.stderr

This file was deleted.

5 changes: 2 additions & 3 deletions tests/ui-toml/absolute_paths/absolute_paths_2015.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//@[default]rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/absolute_paths/default
//@[allow_crates]rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/absolute_paths/allow_crates
//@edition:2015
//@check-pass

#![deny(clippy::absolute_paths)]

Expand All @@ -11,6 +12,4 @@ mod m1 {
}
}

fn main() {
let _ = ::m1::m2::X; //~[default] absolute_paths
}
fn main() {}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ fn main() {
let local_opt: Option<i32> = Some(3);

println!("val='{local_i32}'");
//~^ uninlined_format_args
println!("Hello x is {local_f64:.local_i32$}");
//~^ uninlined_format_args
//~| print_literal
println!("Hello {local_i32} is {local_f64:.*}", 5);
//~^ uninlined_format_args
println!("Hello {local_i32} is {local_f64:.*}", 5);
//~^ uninlined_format_args
println!("{local_i32}, {}", local_opt.unwrap());
//~^ uninlined_format_args
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@ fn main() {
let local_opt: Option<i32> = Some(3);

println!("val='{}'", local_i32);
//~^ uninlined_format_args
println!("Hello {} is {:.*}", "x", local_i32, local_f64);
//~^ uninlined_format_args
//~| print_literal
println!("Hello {} is {:.*}", local_i32, 5, local_f64);
//~^ uninlined_format_args
println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
//~^ uninlined_format_args
println!("{}, {}", local_i32, local_opt.unwrap());
//~^ uninlined_format_args
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ LL + println!("val='{local_i32}'");
|

error: variables can be used directly in the `format!` string
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:10:5
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:11:5
|
LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -25,7 +25,7 @@ LL + println!("Hello {} is {local_f64:.local_i32$}", "x");
|

error: literal with an empty format string
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:10:35
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:11:35
|
LL | println!("Hello {} is {:.*}", "x", local_i32, local_f64);
| ^^^
Expand All @@ -39,7 +39,7 @@ LL + println!("Hello x is {:.*}", local_i32, local_f64);
|

error: variables can be used directly in the `format!` string
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:11:5
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:14:5
|
LL | println!("Hello {} is {:.*}", local_i32, 5, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -51,7 +51,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
|

error: variables can be used directly in the `format!` string
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:12:5
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:16:5
|
LL | println!("Hello {} is {2:.*}", local_i32, 5, local_f64);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -63,7 +63,7 @@ LL + println!("Hello {local_i32} is {local_f64:.*}", 5);
|

error: variables can be used directly in the `format!` string
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:13:5
--> tests/ui-toml/allow_mixed_uninlined_format_args/uninlined_format_args.rs:18:5
|
LL | println!("{}, {}", local_i32, local_opt.unwrap());
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
5 changes: 5 additions & 0 deletions tests/ui-toml/arbitrary_source_item_ordering/ordering_good.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
//@[bad_conf_1] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/arbitrary_source_item_ordering/bad_conf_1
//@[bad_conf_2] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/arbitrary_source_item_ordering/bad_conf_2
//@[bad_conf_3] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/arbitrary_source_item_ordering/bad_conf_3
//@[default] check-pass
//@[default_exp] check-pass
//@[bad_conf_1] error-in-other-file:
//@[bad_conf_2] error-in-other-file:
//@[bad_conf_3] error-in-other-file:

#![allow(dead_code)]
#![warn(clippy::arbitrary_source_item_ordering)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//@aux-build:../../ui/auxiliary/proc_macros.rs
//@revisions: var_1
//@[var_1] rustc-env:CLIPPY_CONF_DIR=tests/ui-toml/arbitrary_source_item_ordering/var_1
//@check-pass

#![allow(dead_code)]
#![warn(clippy::arbitrary_source_item_ordering)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:21:14
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:22:14
|
LL | use std::rc::Weak;
| ^^^^
|
note: should be placed before `SNAKE_CASE`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:19:7
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:20:7
|
LL | const SNAKE_CASE: &str = "zzzzzzzz";
| ^^^^^^^^^^
= note: `-D clippy::arbitrary-source-item-ordering` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::arbitrary_source_item_ordering)]`

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:64:1
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:67:1
|
LL | / impl CloneSelf for StructOrdered {
LL | |
LL | | fn clone_self(&self) -> Self {
LL | | Self {
LL | | a: true,
... |
LL | | }
| |_^
|
note: should be placed before the following item
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:54:1
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:57:1
|
LL | / impl Default for StructOrdered {
LL | | fn default() -> Self {
Expand All @@ -35,55 +35,54 @@ LL | | }
| |_^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:136:7
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:145:7
|
LL | const ZIS_SHOULD_BE_REALLY_EARLY: () = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: should be placed before `TraitUnorderedItemKinds`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:124:7
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:132:7
|
LL | trait TraitUnorderedItemKinds {
| ^^^^^^^^^^^^^^^^^^^^^^^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:151:1
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:163:1
|
LL | impl BasicEmptyTrait for StructOrdered {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: should be placed before the following item
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:138:1
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:148:1
|
LL | / impl TraitUnordered for StructUnordered {
LL | | const A: bool = false;
LL | | const C: bool = false;
LL | | const B: bool = false;
... |
LL | | fn b() {}
LL | | }
| |_^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:170:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:184:5
|
LL | mod this_is_in_the_wrong_position {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: should be placed before `main`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:165:4
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:179:4
|
LL | fn main() {
| ^^^^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:178:7
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:194:7
|
LL | const ZIS_SHOULD_BE_EVEN_EARLIER: () = ();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: should be placed before `ZisShouldBeBeforeZeMainFn`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:176:8
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:192:8
|
LL | struct ZisShouldBeBeforeZeMainFn;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Expand All @@ -101,121 +100,121 @@ LL | const BEFORE: i8 = 0;
| ^^^^^^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:38:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:40:5
|
LL | B,
| ^
|
note: should be placed before `C`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:37:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:39:5
|
LL | C,
| ^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:88:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:92:5
|
LL | b: bool,
| ^
|
note: should be placed before `c`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:87:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:91:5
|
LL | c: bool,
| ^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:96:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:101:5
|
LL | b: bool,
| ^
|
note: should be placed before `c`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:95:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:100:5
|
LL | c: bool,
| ^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:115:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:121:11
|
LL | const B: bool;
| ^
|
note: should be placed before `C`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:114:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:120:11
|
LL | const C: bool;
| ^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:121:8
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:128:8
|
LL | fn b();
| ^
|
note: should be placed before `c`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:120:8
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:127:8
|
LL | fn c();
| ^

error: incorrect ordering of trait items (defined order: [Const, Type, Fn])
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:127:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:135:5
|
LL | const A: bool;
| ^^^^^^^^^^^^^^
|
note: should be placed before `SomeType`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:125:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:133:5
|
LL | type SomeType;
| ^^^^^^^^^^^^^^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:141:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:151:11
|
LL | const B: bool = false;
| ^
|
note: should be placed before `C`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:140:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:150:11
|
LL | const C: bool = false;
| ^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:147:8
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:158:8
|
LL | fn b() {}
| ^
|
note: should be placed before `c`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:146:8
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:157:8
|
LL | fn c() {}
| ^

error: incorrect ordering of impl items (defined order: [Const, Type, Fn])
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:156:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:169:5
|
LL | const A: bool = false;
| ^^^^^^^^^^^^^^^^^^^^^^
|
note: should be placed before `SomeType`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:154:5
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:167:5
|
LL | type SomeType = ();
| ^^^^^^^^^^^^^^^^^^^

error: incorrect ordering of items (must be alphabetically ordered)
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:172:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:187:11
|
LL | const A: i8 = 1;
| ^
|
note: should be placed before `C`
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:171:11
--> tests/ui-toml/arbitrary_source_item_ordering/ordering_mixed.rs:186:11
|
LL | const C: i8 = 0;
| ^
Expand Down
Loading

0 comments on commit 3053bad

Please sign in to comment.