mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 06:47:34 +00:00
19 lines
333 B
Rust
19 lines
333 B
Rust
#![warn(clippy::default_numeric_fallback)]
|
|
#![allow(unused)]
|
|
|
|
fn main() {
|
|
// Bad.
|
|
let x = 1;
|
|
let x = 0.1;
|
|
let x = if true { 1 } else { 2 };
|
|
|
|
// Good.
|
|
let x = 1_i32;
|
|
let x: i32 = 1;
|
|
let x: _ = 1;
|
|
let x = 0.1_f64;
|
|
let x: f64 = 0.1;
|
|
let x: _ = 0.1;
|
|
let x: _ = if true { 1 } else { 2 };
|
|
}
|