diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2025-07-10 10:25:32 -0700 |
|---|---|---|
| committer | Dan Johnson <ComputerDruid@gmail.com> | 2025-07-10 11:56:54 -0700 |
| commit | ae6416aa866d455fb636934bf0911095e2c8cdea (patch) | |
| tree | 45f93b1588c4a7976c6900982de4f8274ae26ce1 /tests | |
| parent | e30313cc6b140e0a7f88e85bf9ec9440bfb4c82e (diff) | |
| download | rust-ae6416aa866d455fb636934bf0911095e2c8cdea.tar.gz rust-ae6416aa866d455fb636934bf0911095e2c8cdea.zip | |
add extra legacy_numeric_constants test cases
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/legacy_numeric_constants.fixed | 7 | ||||
| -rw-r--r-- | tests/ui/legacy_numeric_constants.rs | 7 | ||||
| -rw-r--r-- | tests/ui/legacy_numeric_constants.stderr | 28 |
3 files changed, 40 insertions, 2 deletions
diff --git a/tests/ui/legacy_numeric_constants.fixed b/tests/ui/legacy_numeric_constants.fixed index 5f3c3308de8..d90e7bec027 100644 --- a/tests/ui/legacy_numeric_constants.fixed +++ b/tests/ui/legacy_numeric_constants.fixed @@ -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)] diff --git a/tests/ui/legacy_numeric_constants.rs b/tests/ui/legacy_numeric_constants.rs index 0bb27532b41..4a2ef3f70c2 100644 --- a/tests/ui/legacy_numeric_constants.rs +++ b/tests/ui/legacy_numeric_constants.rs @@ -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)] diff --git a/tests/ui/legacy_numeric_constants.stderr b/tests/ui/legacy_numeric_constants.stderr index 41e94fc8aae..0b4f32e0abc 100644 --- a/tests/ui/legacy_numeric_constants.stderr +++ b/tests/ui/legacy_numeric_constants.stderr @@ -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 |
