File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -134,13 +134,13 @@ impl LateLintPass for StringLitAsBytes {
134134 fn check_expr ( & mut self , cx : & LateContext , e : & Expr ) {
135135 use std:: ascii:: AsciiExt ;
136136 use syntax:: ast:: Lit_ :: LitStr ;
137- use utils:: snippet;
137+ use utils:: { snippet, in_external_macro } ;
138138
139139 if let ExprMethodCall ( ref name, _, ref args) = e. node {
140140 if name. node . as_str ( ) == "as_bytes" {
141141 if let ExprLit ( ref lit) = args[ 0 ] . node {
142142 if let LitStr ( ref lit_content, _) = lit. node {
143- if lit_content. chars ( ) . all ( |c| c. is_ascii ( ) ) {
143+ if lit_content. chars ( ) . all ( |c| c. is_ascii ( ) ) && ! in_external_macro ( cx , e . span ) {
144144 let msg = format ! ( "calling `as_bytes()` on a string literal. \
145145 Consider using a byte string literal instead: \
146146 `b{}`",
You can’t perform that action at this time.
0 commit comments