Skip to content

Commit ae6416a

Browse files
samueltardieuComputerDruid
authored andcommitted
add extra legacy_numeric_constants test cases
1 parent e30313c commit ae6416a

File tree

3 files changed

+40
-2
lines changed

3 files changed

+40
-2
lines changed

tests/ui/legacy_numeric_constants.fixed

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ fn main() {
9797
u32::MAX;
9898
//~^ ERROR: usage of a legacy numeric method
9999
//~| HELP: use the associated constant instead
100+
i32::MAX;
101+
//~^ ERROR: usage of a legacy numeric method
102+
//~| HELP: use the associated constant instead
103+
type Ω = i32;
104+
Ω::MAX;
105+
//~^ ERROR: usage of a legacy numeric method
106+
//~| HELP: use the associated constant instead
100107
}
101108

102109
#[warn(clippy::legacy_numeric_constants)]

tests/ui/legacy_numeric_constants.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,13 @@ fn main() {
9797
(<u32>::max_value());
9898
//~^ ERROR: usage of a legacy numeric method
9999
//~| HELP: use the associated constant instead
100+
((i32::max_value)());
101+
//~^ ERROR: usage of a legacy numeric method
102+
//~| HELP: use the associated constant instead
103+
type Ω = i32;
104+
Ω::max_value();
105+
//~^ ERROR: usage of a legacy numeric method
106+
//~| HELP: use the associated constant instead
100107
}
101108

102109
#[warn(clippy::legacy_numeric_constants)]

tests/ui/legacy_numeric_constants.stderr

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,32 @@ LL - (<u32>::max_value());
243243
LL + u32::MAX;
244244
|
245245

246+
error: usage of a legacy numeric method
247+
--> tests/ui/legacy_numeric_constants.rs:100:5
248+
|
249+
LL | ((i32::max_value)());
250+
| ^^^^^^^^^^^^^^^^^^^^
251+
|
252+
help: use the associated constant instead
253+
|
254+
LL - ((i32::max_value)());
255+
LL + i32::MAX;
256+
|
257+
258+
error: usage of a legacy numeric method
259+
--> tests/ui/legacy_numeric_constants.rs:104:5
260+
|
261+
LL | Ω::max_value();
262+
| ^^^^^^^^^^^^^^
263+
|
264+
help: use the associated constant instead
265+
|
266+
LL - Ω::max_value();
267+
LL + Ω::MAX;
268+
|
269+
246270
error: usage of a legacy numeric constant
247-
--> tests/ui/legacy_numeric_constants.rs:131:5
271+
--> tests/ui/legacy_numeric_constants.rs:138:5
248272
|
249273
LL | std::u32::MAX;
250274
| ^^^^^^^^^^^^^
@@ -255,5 +279,5 @@ LL - std::u32::MAX;
255279
LL + u32::MAX;
256280
|
257281

258-
error: aborting due to 21 previous errors
282+
error: aborting due to 23 previous errors
259283

0 commit comments

Comments
 (0)