]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unseparated_prefix_literals.rs
Auto merge of #84620 - Dylan-DPC:rollup-wkv97im, r=Dylan-DPC
[rust.git] / src / tools / clippy / tests / ui / unseparated_prefix_literals.rs
1 // run-rustfix
2
3 #![warn(clippy::unseparated_literal_suffix)]
4 #![allow(dead_code)]
5
6 #[macro_use]
7 extern crate clippy_mini_macro_test;
8
9 // Test for proc-macro attribute
10 #[derive(ClippyMiniMacroTest)]
11 struct Foo;
12
13 macro_rules! lit_from_macro {
14     () => {
15         42usize
16     };
17 }
18
19 fn main() {
20     let _ok1 = 1234_i32;
21     let _ok2 = 1234_isize;
22     let _ok3 = 0x123_isize;
23     let _fail1 = 1234i32;
24     let _fail2 = 1234u32;
25     let _fail3 = 1234isize;
26     let _fail4 = 1234usize;
27     let _fail5 = 0x123isize;
28
29     let _okf1 = 1.5_f32;
30     let _okf2 = 1_f32;
31     let _failf1 = 1.5f32;
32     let _failf2 = 1f32;
33
34     // Test for macro
35     let _ = lit_from_macro!();
36
37     // Counter example
38     let _ = line!();
39     // Because `assert!` contains `line!()` macro.
40     assert_eq!(4897u32, 32223);
41 }