]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/strings.rs
Fix false positive in `string_add`.
[rust.git] / clippy_lints / src / strings.rs
index 5261d8585669ca478ddce2382283bf6103b335de..c1d441c39358af24dfc00da36cefdb9f565b6f1f 100644 (file)
@@ -8,7 +8,9 @@
 use if_chain::if_chain;
 
 use crate::utils::SpanlessEq;
-use crate::utils::{get_parent_expr, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty};
+use crate::utils::{
+    get_parent_expr, in_macro, is_allowed, match_type, paths, span_lint, span_lint_and_sugg, walk_ptrs_ty,
+};
 
 declare_clippy_lint! {
     /// **What it does:** Checks for string appends of the form `x = x + y` (without
 
 impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringAdd {
     fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr) {
+        if in_macro(e.span) {
+            return;
+        }
+
         if let ExprKind::Binary(
             Spanned {
                 node: BinOpKind::Add, ..