summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/unnecessary_cast_fixable.fixed
blob: 3332f49c80c9758c2f8cbd61fc19d48a7681dfee (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
// run-rustfix

#![warn(clippy::unnecessary_cast)]
#![allow(
    clippy::no_effect,
    clippy::unnecessary_operation,
    clippy::nonstandard_macro_braces,
    clippy::borrow_as_ptr
)]

fn main() {
    // casting integer literal to float is unnecessary
    100_f32;
    100_f64;
    100_f64;
    let _ = -100_f32;
    let _ = -100_f64;
    let _ = -100_f64;
    100_f32;
    100_f64;
    // Should not trigger
    #[rustfmt::skip]
    let v = vec!(1);
    &v as &[i32];
    0x10 as f32;
    0o10 as f32;
    0b10 as f32;
    0x11 as f64;
    0o11 as f64;
    0b11 as f64;

    1_u32;
    0x10_i32;
    0b10_usize;
    0o73_u16;
    1_000_000_000_u32;

    1.0_f64;
    0.5_f32;

    1.0 as u16;

    let _ = -1_i32;
    let _ = -1.0_f32;
}