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
+1 -1
View File
@@ -140,7 +140,7 @@ fn check_expr(&mut self, cx: &LateContext, e: &Expr) {
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{}`",