]> git.lizzy.rs Git - rust.git/commitdiff
Fix FP in `ZERO_PREFIXED_LITERAL` and `0b`/`Oo`
authormcarton <cartonmartin+git@gmail.com>
Sun, 28 Aug 2016 15:59:01 +0000 (17:59 +0200)
committermcarton <cartonmartin+git@gmail.com>
Sun, 28 Aug 2016 16:00:09 +0000 (18:00 +0200)
CHANGELOG.md
clippy_lints/src/misc_early.rs
tests/compile-fail/literals.rs

index 185072debab10df08a42fb7c1f485319ce555bc1..636ca3f4f2bebe12a175cf3902a7a4bb143eecf5 100644 (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`]
index 916801943b75b6c682d9b74e188d92f4f308027f..83ba980334af4612111375f425665b3d9f67f9e9 100644 (file)
@@ -287,6 +287,8 @@ fn check_expr(&mut self, cx: &EarlyContext, expr: &Expr) {
                             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,
index 91a63646998c84a009c1c66e882d92cdd82b509c..6c8a27c2ed4a2d85347479ae774dc9d9bcb43ba4 100644 (file)
@@ -32,4 +32,7 @@ fn main() {
     //~|SUGGESTION = 123;
     //~|HELP use `0o`
     //~|SUGGESTION = 0o123;
+
+    let ok11 = 0o123;
+    let ok12 = 0b101010;
 }