]> git.proxmox.com Git - rustc.git/blobdiff - src/tools/clippy/tests/ui/unseparated_prefix_literals.fixed
Update upstream source from tag 'upstream/1.52.1+dfsg1'
[rustc.git] / src / tools / clippy / tests / ui / unseparated_prefix_literals.fixed
diff --git a/src/tools/clippy/tests/ui/unseparated_prefix_literals.fixed b/src/tools/clippy/tests/ui/unseparated_prefix_literals.fixed
new file mode 100644 (file)
index 0000000..3c422cc
--- /dev/null
@@ -0,0 +1,41 @@
+// run-rustfix
+
+#![warn(clippy::unseparated_literal_suffix)]
+#![allow(dead_code)]
+
+#[macro_use]
+extern crate clippy_mini_macro_test;
+
+// Test for proc-macro attribute
+#[derive(ClippyMiniMacroTest)]
+struct Foo;
+
+macro_rules! lit_from_macro {
+    () => {
+        42_usize
+    };
+}
+
+fn main() {
+    let _ok1 = 1234_i32;
+    let _ok2 = 1234_isize;
+    let _ok3 = 0x123_isize;
+    let _fail1 = 1234_i32;
+    let _fail2 = 1234_u32;
+    let _fail3 = 1234_isize;
+    let _fail4 = 1234_usize;
+    let _fail5 = 0x123_isize;
+
+    let _okf1 = 1.5_f32;
+    let _okf2 = 1_f32;
+    let _failf1 = 1.5_f32;
+    let _failf2 = 1_f32;
+
+    // Test for macro
+    let _ = lit_from_macro!();
+
+    // Counter example
+    let _ = line!();
+    // Because `assert!` contains `line!()` macro.
+    assert_eq!(4897_u32, 32223);
+}