|
1 | 1 | use crate::utils::{
|
2 |
| - match_def_path, match_qpath, paths, snippet_with_applicability, span_help_and_lint, span_lint_and_sugg, |
| 2 | + in_macro, match_def_path, match_qpath, paths, snippet_with_applicability, span_help_and_lint, span_lint_and_sugg, |
3 | 3 | };
|
4 | 4 | use if_chain::if_chain;
|
5 | 5 | use rustc::declare_lint_pass;
|
6 | 6 | use rustc::hir::{BorrowKind, Expr, ExprKind, HirVec, Mutability, QPath};
|
7 |
| -use rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; |
| 7 | +use rustc::lint::{in_external_macro, LateContext, LateLintPass, LintArray, LintPass}; |
8 | 8 | use rustc_errors::Applicability;
|
9 | 9 | use rustc_session::declare_tool_lint;
|
10 | 10 |
|
@@ -163,9 +163,9 @@ fn check_replace_with_uninit(cx: &LateContext<'_, '_>, expr: &'_ Expr, args: &Hi
|
163 | 163 | }
|
164 | 164 |
|
165 | 165 | fn check_replace_with_default(cx: &LateContext<'_, '_>, expr: &'_ Expr, args: &HirVec<Expr>) {
|
166 |
| - if let ExprKind::Call(ref repl_func, ref repl_args) = args[1].kind { |
| 166 | + if let ExprKind::Call(ref repl_func, _) = args[1].kind { |
167 | 167 | if_chain! {
|
168 |
| - if repl_args.is_empty(); |
| 168 | + if !in_macro(expr.span) && !in_external_macro(cx.tcx.sess, expr.span); |
169 | 169 | if let ExprKind::Path(ref repl_func_qpath) = repl_func.kind;
|
170 | 170 | if let Some(repl_def_id) = cx.tables.qpath_res(repl_func_qpath, repl_func.hir_id).opt_def_id();
|
171 | 171 | if match_def_path(cx, repl_def_id, &paths::DEFAULT_TRAIT_METHOD);
|
|
0 commit comments