blob: 9bf0f7f355aee25b8d32ef17d9b8d771f150c41e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
//@no-rustfix
//@require-annotations-for-level: WARN
//@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 _;
//~^ ERROR: importing legacy numeric constants
//~| HELP: remove this import
pub mod a {
pub use std::{mem, u128};
//~^ ERROR: importing legacy numeric constants
//~| HELP: remove this import
}
macro_rules! b {
() => {
mod b {
use std::u32;
//~^ ERROR: importing legacy numeric constants
//~| HELP: remove this import
}
};
}
fn main() {
use std::u32::MAX;
//~^ ERROR: importing a legacy numeric constant
//~| HELP: remove this import and use the associated constant `u32::MAX`
use std::u8::MIN;
//~^ ERROR: importing a legacy numeric constant
//~| HELP: remove this import and use the associated constant `u8::MIN`
f64::MAX;
use std::u32;
//~^ ERROR: importing legacy numeric constants
//~| HELP: remove this import
u32::MAX;
use std::f32::MIN_POSITIVE;
//~^ ERROR: importing a legacy numeric constant
//~| HELP: remove this import and use the associated constant `f32::MIN_POSITIVE`
use std::f64;
use std::i16::*;
//~^ ERROR: importing legacy numeric constants
//~| HELP: remove this import and use associated constants `i16::<CONST>`
u128::MAX;
f32::EPSILON;
f64::EPSILON;
::std::primitive::u8::MIN;
std::f32::consts::E;
f64::consts::E;
u8::MIN;
std::f32::consts::E;
f64::consts::E;
b!();
}
fn ext() {
external! {
::std::primitive::u8::MIN;
::std::u8::MIN;
::std::primitive::u8::min_value();
use std::u64;
use std::u8::MIN;
}
}
#[clippy::msrv = "1.42.0"]
fn msrv_too_low() {
use std::u32::MAX;
}
#[clippy::msrv = "1.43.0"]
fn msrv_juust_right() {
use std::u32::MAX;
//~^ ERROR: importing a legacy numeric constant
}
|