add extra legacy_numeric_constants test cases

This commit is contained in:
Samuel Tardieu 2025-07-10 10:25:32 -07:00 committed by Dan Johnson
parent e30313cc6b
commit ae6416aa86
3 changed files with 40 additions and 2 deletions

View file

@ -97,6 +97,13 @@ fn main() {
u32::MAX;
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
i32::MAX;
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
type Ω = i32;
Ω::MAX;
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
}
#[warn(clippy::legacy_numeric_constants)]

View file

@ -97,6 +97,13 @@ fn main() {
(<u32>::max_value());
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
((i32::max_value)());
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
type Ω = i32;
Ω::max_value();
//~^ ERROR: usage of a legacy numeric method
//~| HELP: use the associated constant instead
}
#[warn(clippy::legacy_numeric_constants)]

View file

@ -243,8 +243,32 @@ LL - (<u32>::max_value());
LL + u32::MAX;
|
error: usage of a legacy numeric method
--> tests/ui/legacy_numeric_constants.rs:100:5
|
LL | ((i32::max_value)());
| ^^^^^^^^^^^^^^^^^^^^
|
help: use the associated constant instead
|
LL - ((i32::max_value)());
LL + i32::MAX;
|
error: usage of a legacy numeric method
--> tests/ui/legacy_numeric_constants.rs:104:5
|
LL | Ω::max_value();
| ^^^^^^^^^^^^^^
|
help: use the associated constant instead
|
LL - Ω::max_value();
LL + Ω::MAX;
|
error: usage of a legacy numeric constant
--> tests/ui/legacy_numeric_constants.rs:131:5
--> tests/ui/legacy_numeric_constants.rs:138:5
|
LL | std::u32::MAX;
| ^^^^^^^^^^^^^
@ -255,5 +279,5 @@ LL - std::u32::MAX;
LL + u32::MAX;
|
error: aborting due to 21 previous errors
error: aborting due to 23 previous errors