Skip to content

Commit 6ea3a0a

Browse files
committed
Fix suggestion for separated_literal_suffix
1 parent b25c59f commit 6ea3a0a

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

clippy_lints/src/misc_early/literal_suffix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) fn check(cx: &EarlyContext<'_>, lit: &Lit, lit_snip: &str, suffix: &s
2020
lit.span,
2121
&format!("{} type suffix should not be separated by an underscore", sugg_type),
2222
"remove the underscore",
23-
format!("{}{}", &lit_snip[..=maybe_last_sep_idx], suffix),
23+
format!("{}{}", &lit_snip[..maybe_last_sep_idx], suffix),
2424
Applicability::MachineApplicable,
2525
);
2626
} else {

tests/ui/literals.stderr

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@ error: integer type suffix should not be separated by an underscore
22
--> $DIR/literals.rs:12:15
33
|
44
LL | let ok4 = 0xab_cd_i32;
5-
| ^^^^^^^^^^^ help: remove the underscore: `0xab_cd_i32`
5+
| ^^^^^^^^^^^ help: remove the underscore: `0xab_cdi32`
66
|
77
= note: `-D clippy::separated-literal-suffix` implied by `-D warnings`
88

99
error: integer type suffix should not be separated by an underscore
1010
--> $DIR/literals.rs:13:15
1111
|
1212
LL | let ok5 = 0xAB_CD_u32;
13-
| ^^^^^^^^^^^ help: remove the underscore: `0xAB_CD_u32`
13+
| ^^^^^^^^^^^ help: remove the underscore: `0xAB_CDu32`
1414

1515
error: integer type suffix should not be separated by an underscore
1616
--> $DIR/literals.rs:14:15
1717
|
1818
LL | let ok5 = 0xAB_CD_isize;
19-
| ^^^^^^^^^^^^^ help: remove the underscore: `0xAB_CD_isize`
19+
| ^^^^^^^^^^^^^ help: remove the underscore: `0xAB_CDisize`
2020

2121
error: inconsistent casing in hexadecimal literal
2222
--> $DIR/literals.rs:15:17
@@ -30,7 +30,7 @@ error: integer type suffix should not be separated by an underscore
3030
--> $DIR/literals.rs:16:17
3131
|
3232
LL | let fail2 = 0xabCD_u32;
33-
| ^^^^^^^^^^ help: remove the underscore: `0xabCD_u32`
33+
| ^^^^^^^^^^ help: remove the underscore: `0xabCDu32`
3434

3535
error: inconsistent casing in hexadecimal literal
3636
--> $DIR/literals.rs:16:17
@@ -42,7 +42,7 @@ error: integer type suffix should not be separated by an underscore
4242
--> $DIR/literals.rs:17:17
4343
|
4444
LL | let fail2 = 0xabCD_isize;
45-
| ^^^^^^^^^^^^ help: remove the underscore: `0xabCD_isize`
45+
| ^^^^^^^^^^^^ help: remove the underscore: `0xabCDisize`
4646

4747
error: inconsistent casing in hexadecimal literal
4848
--> $DIR/literals.rs:17:17
@@ -78,7 +78,7 @@ error: integer type suffix should not be separated by an underscore
7878
--> $DIR/literals.rs:21:16
7979
|
8080
LL | let ok10 = 0_i64;
81-
| ^^^^^ help: remove the underscore: `0_i64`
81+
| ^^^^^ help: remove the underscore: `0i64`
8282

8383
error: this is a decimal constant
8484
--> $DIR/literals.rs:22:17
@@ -99,7 +99,7 @@ error: integer type suffix should not be separated by an underscore
9999
--> $DIR/literals.rs:31:16
100100
|
101101
LL | let ok17 = 0x123_4567_8901_usize;
102-
| ^^^^^^^^^^^^^^^^^^^^^ help: remove the underscore: `0x123_4567_8901_usize`
102+
| ^^^^^^^^^^^^^^^^^^^^^ help: remove the underscore: `0x123_4567_8901usize`
103103

104104
error: digits grouped inconsistently by underscores
105105
--> $DIR/literals.rs:34:18

0 commit comments

Comments
 (0)