mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Fix false positive with STRING_LIT_AS_BYTES and stringify!
This commit is contained in:
+1
-1
@@ -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{}`",
|
||||
|
||||
Reference in New Issue
Block a user