Fix hints from misc_early

This commit is contained in:
Jay Hardee 2017-07-31 20:20:27 -04:00
parent 5dbdfc1836
commit 9b78086ab3
2 changed files with 6 additions and 6 deletions

View File

@ -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')),
);
});
}

View File

@ -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