From ae6416aa866d455fb636934bf0911095e2c8cdea Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Thu, 10 Jul 2025 10:25:32 -0700 Subject: [PATCH] add extra legacy_numeric_constants test cases --- tests/ui/legacy_numeric_constants.fixed | 7 ++++++ tests/ui/legacy_numeric_constants.rs | 7 ++++++ 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 5f3c3308de88..d90e7bec027c 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 0bb27532b41d..4a2ef3f70c21 100644 --- a/tests/ui/legacy_numeric_constants.rs +++ b/tests/ui/legacy_numeric_constants.rs @@ -97,6 +97,13 @@ fn main() { (::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 41e94fc8aaec..0b4f32e0abc3 100644 --- a/tests/ui/legacy_numeric_constants.stderr +++ b/tests/ui/legacy_numeric_constants.stderr @@ -243,8 +243,32 @@ LL - (::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