blob: 577bbff2957fb19b0410c48c3774534b6de385c4 (
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
|
#![warn(clippy::excessive_precision)]
#![allow(
dead_code,
overflowing_literals,
unused_variables,
clippy::print_literal,
clippy::useless_vec
)]
fn main() {
// Overly specified constants
let _: f32 = 1.012_345_7;
//~^ excessive_precision
let _: f64 = 1.012_345_678_901_234_6;
//~^ excessive_precision
const _: f32 = 1.012345678901234567890;
const _: f64 = 1.012345678901234567890;
static STATIC1: f32 = 1.012345678901234567890;
static STATIC2: f64 = 1.012345678901234567890;
static mut STATIC_MUT1: f32 = 1.012345678901234567890;
static mut STATIC_MUT2: f64 = 1.012345678901234567890;
}
trait ExcessivelyPreciseTrait {
// Overly specified constants
const GOOD1: f32 = 1.012345678901234567890;
const GOOD2: f64 = 1.012345678901234567890;
}
struct ExcessivelyPreciseStruct;
impl ExcessivelyPreciseStruct {
// Overly specified constants
const GOOD1: f32 = 1.012345678901234567890;
const GOOD2: f64 = 1.012345678901234567890;
}
|