Skip to content

Commit 6d4e1bd

Browse files
committed
Fix false positive with STRING_LIT_AS_BYTES and stringify!
1 parent 1546cc4 commit 6d4e1bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/strings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl LateLintPass for StringLitAsBytes {
140140
if name.node.as_str() == "as_bytes" {
141141
if let ExprLit(ref lit) = args[0].node {
142142
if let LitKind::Str(ref lit_content, _) = lit.node {
143-
if lit_content.chars().all(|c| c.is_ascii()) && !in_macro(cx, e.span) {
143+
if lit_content.chars().all(|c| c.is_ascii()) && !in_macro(cx, args[0].span) {
144144
let msg = format!("calling `as_bytes()` on a string literal. \
145145
Consider using a byte string literal instead: \
146146
`b{}`",

0 commit comments

Comments
 (0)