From 9b78086ab350ba4b177e64df1eec0ff079fe56f2 Mon Sep 17 00:00:00 2001 From: Jay Hardee Date: Mon, 31 Jul 2017 20:20:27 -0400 Subject: [PATCH] Fix hints from misc_early --- clippy_lints/src/misc_early.rs | 4 ++-- clippy_tests/examples/literals.stderr | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index c7d459acab01..c63dff52ae92 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -367,12 +367,12 @@ impl MiscEarly { db.span_suggestion( lit.span, "if you mean to use a decimal constant, remove the `0` to remove confusion", - src.trim_left_matches('0').to_string(), + src.trim_left_matches(|c| c == '_' || c == '0').to_string(), ); db.span_suggestion( lit.span, "if you mean to use an octal constant, use `0o`", - format!("0o{}", src.trim_left_matches('0')), + format!("0o{}", src.trim_left_matches(|c| c == '_' || c == '0')), ); }); } diff --git a/clippy_tests/examples/literals.stderr b/clippy_tests/examples/literals.stderr index db67e3f190c3..05f623cae951 100644 --- a/clippy_tests/examples/literals.stderr +++ b/clippy_tests/examples/literals.stderr @@ -35,12 +35,12 @@ error: this is a decimal constant = note: `-D zero-prefixed-literal` implied by `-D warnings` help: if you mean to use a decimal constant, remove the `0` to remove confusion | -17 | let fail_multi_zero = _123usize; - | ^^^^^^^^^ +17 | let fail_multi_zero = 123usize; + | ^^^^^^^^ help: if you mean to use an octal constant, use `0o` | -17 | let fail_multi_zero = 0o_123usize; - | ^^^^^^^^^^^ +17 | let fail_multi_zero = 0o123usize; + | ^^^^^^^^^^ error: integer type suffix should be separated by an underscore --> literals.rs:22:17