From: flip1995 Date: Sat, 3 Mar 2018 20:55:04 +0000 (+0100) Subject: Improve getting literal representation X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=fc33b2567cac0ae453807f4118872ab81a16ddf7;p=rust.git Improve getting literal representation --- diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index 02aef271c37..e778b2d3861 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -368,7 +368,7 @@ fn get_bin_hex_repr(cx: &LateContext, lit: &ast::Lit) -> Option { let src = cx.sess().codemap().span_to_snippet(lit.span).ok()?; let firstch = src.chars().next()?; - if let Some(0) = char::to_digit(firstch, 10) { + if firstch == '0' { match src.chars().nth(1) { Some('x') | Some('b') => return Some(src), _ => return None,