Merge pull request #1203 from Manishearth/octal

Fix FP in `ZERO_PREFIXED_LITERAL` and `0b`/`Oo`
This commit is contained in:
Martin Carton 2016-08-28 18:04:03 +02:00 committed by GitHub
commit 39d4a1b323
3 changed files with 8 additions and 0 deletions

View File

@ -1,6 +1,9 @@
# Change Log
All notable changes to this project will be documented in this file.
## 0.0.87 — ??
* Fix FP in [`zero_prefixed_literal`] and `0b`/`Oo`
## 0.0.86 — 2016-08-28
* Rustup to *rustc 1.13.0-nightly (a23064af5 2016-08-27)*
* New lints: [`missing_docs_in_private_items`], [`zero_prefixed_literal`]

View File

@ -287,6 +287,8 @@ impl EarlyLintPass for MiscEarly {
span_lint(cx, MIXED_CASE_HEX_LITERALS, lit.span,
"inconsistent casing in hexadecimal literal");
}
} else if src.starts_with("0b") || src.starts_with("0o") {
/* nothing to do */
} else if value != 0 && src.starts_with('0') {
span_lint_and_then(cx,
ZERO_PREFIXED_LITERAL,

View File

@ -32,4 +32,7 @@ fn main() {
//~|SUGGESTION = 123;
//~|HELP use `0o`
//~|SUGGESTION = 0o123;
let ok11 = 0o123;
let ok12 = 0b101010;
}