deal with multiple prefixed zeros in literals

This commit is contained in:
Andre Bogus
2017-06-12 20:41:00 +02:00
parent b1e9c1b7e7
commit 3a8e4c33bd
3 changed files with 34 additions and 13 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[1..].to_string(),
src.trim_left_matches('0').to_string(),
);
db.span_suggestion(
lit.span,
"if you mean to use an octal constant, use `0o`:",
format!("0o{}", &src[1..]),
format!("0o{}", src.trim_left_matches('0')),
);
});
}