Fix false positive with STRING_LIT_AS_BYTES and stringify!

This commit is contained in:
mcarton 2016-03-14 22:00:01 +01:00
parent 1546cc4798
commit 6d4e1bd73d

View file

@ -140,7 +140,7 @@ impl LateLintPass for StringLitAsBytes {
if name.node.as_str() == "as_bytes" {
if let ExprLit(ref lit) = args[0].node {
if let LitKind::Str(ref lit_content, _) = lit.node {
if lit_content.chars().all(|c| c.is_ascii()) && !in_macro(cx, e.span) {
if lit_content.chars().all(|c| c.is_ascii()) && !in_macro(cx, args[0].span) {
let msg = format!("calling `as_bytes()` on a string literal. \
Consider using a byte string literal instead: \
`b{}`",