mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 23:20:39 +00:00
Fix false positive with STRING_LIT_AS_BYTES and stringify!
This commit is contained in:
parent
1546cc4798
commit
6d4e1bd73d
1 changed files with 1 additions and 1 deletions
|
@ -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{}`",
|
||||
|
|
Loading…
Reference in a new issue