From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- .../clippy/tests/ui/mistyped_literal_suffix.rs | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/tools/clippy/tests/ui/mistyped_literal_suffix.rs (limited to 'src/tools/clippy/tests/ui/mistyped_literal_suffix.rs') diff --git a/src/tools/clippy/tests/ui/mistyped_literal_suffix.rs b/src/tools/clippy/tests/ui/mistyped_literal_suffix.rs new file mode 100644 index 000000000..c97b31965 --- /dev/null +++ b/src/tools/clippy/tests/ui/mistyped_literal_suffix.rs @@ -0,0 +1,43 @@ +// run-rustfix + +#![allow( + dead_code, + unused_variables, + overflowing_literals, + clippy::excessive_precision, + clippy::inconsistent_digit_grouping, + clippy::unusual_byte_groupings +)] + +fn main() { + let fail14 = 2_32; + let fail15 = 4_64; + let fail16 = 7_8; // + let fail17 = 23_16; // + let ok18 = 23_128; + + let fail20 = 2__8; // + let fail21 = 4___16; // + + let ok24 = 12.34_64; + let fail25 = 1E2_32; + let fail26 = 43E7_64; + let fail27 = 243E17_32; + let fail28 = 241251235E723_64; + let ok29 = 42279.911_32; + + // testing that the suggestion actually fits in its type + let fail30 = 127_8; // should be i8 + let fail31 = 240_8; // should be u8 + let ok32 = 360_8; // doesnt fit in either, should be ignored + let fail33 = 0x1234_16; + let fail34 = 0xABCD_16; + let ok35 = 0x12345_16; + let fail36 = 0xFFFF_FFFF_FFFF_FFFF_64; // u64 + + // issue #6129 + let ok37 = 123_32.123; + let ok38 = 124_64.0; + + let _ = 1.12345E1_32; +} -- cgit v1.2.3