-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
117 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
//@run-rustfix | ||
//@aux-build:proc_macros.rs:proc-macro | ||
#![allow(clippy::no_effect, deprecated, unused)] | ||
#![warn(clippy::legacy_numeric_constants)] | ||
|
||
#[macro_use] | ||
extern crate proc_macros; | ||
|
||
use std::u128 as _; | ||
pub mod a { | ||
pub use std::u128; | ||
} | ||
|
||
fn main() { | ||
f32::EPSILON; | ||
u8::MIN; | ||
usize::MIN; | ||
u32::MAX; | ||
u32::MAX; | ||
use std::u32::MAX; | ||
u32::MAX; | ||
u32::MAX; | ||
u8::MAX; | ||
u8::MIN; | ||
::std::primitive::u8::MIN; | ||
::std::u8::MIN; | ||
::std::primitive::u8::MIN; | ||
std::primitive::u32::MAX; | ||
u128::MAX; | ||
// Don't lint | ||
use std::f64; | ||
f32::EPSILON; | ||
u8::MIN; | ||
std::f32::consts::E; | ||
f64::consts::E; | ||
external! { | ||
::std::primitive::u8::MIN; | ||
::std::u8::MIN; | ||
::std::primitive::u8::min_value(); | ||
} | ||
} | ||
|
||
#[clippy::msrv = "1.42.0"] | ||
fn msrv_too_low() { | ||
// FIXME: Why does this lint?? | ||
u32::MAX; | ||
} | ||
|
||
#[clippy::msrv = "1.43.0"] | ||
fn msrv_juust_right() { | ||
u32::MAX; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
//@aux-build:proc_macros.rs | ||
#![allow(clippy::no_effect, deprecated, unused)] | ||
#![warn(clippy::legacy_numeric_constants)] | ||
|
||
#[macro_use] | ||
extern crate proc_macros; | ||
|
||
use std::u128 as _; | ||
|
||
fn main() { | ||
use std::u32; | ||
u32::MAX; | ||
use std::f64; | ||
f64::MAX; | ||
u128::MAX; | ||
// Don't lint | ||
u8::MIN; | ||
std::f32::consts::E; | ||
use std::f32; | ||
f64::consts::E; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
error: usage of a legacy numeric constant | ||
--> $DIR/legacy_numeric_constants_non_rustfix.rs:12:5 | ||
| | ||
LL | u32::MAX; | ||
| ^^^^^^^^ help: use the associated constant instead: `u32::MAX` | ||
| | ||
note: you may need to remove one of the following `use` statements | ||
--> $DIR/legacy_numeric_constants_non_rustfix.rs:11:5 | ||
| | ||
LL | use std::u32; | ||
| ^^^^^^^^^^^^^ | ||
= note: `-D clippy::legacy-numeric-constants` implied by `-D warnings` | ||
|
||
error: usage of a legacy numeric constant | ||
--> $DIR/legacy_numeric_constants_non_rustfix.rs:14:5 | ||
| | ||
LL | f64::MAX; | ||
| ^^^^^^^^ help: use the associated constant instead: `f64::MAX` | ||
| | ||
note: you may need to remove one of the following `use` statements | ||
--> $DIR/legacy_numeric_constants_non_rustfix.rs:13:5 | ||
| | ||
LL | use std::f64; | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 2 previous errors | ||
|