Skip to content

Commit a77bcad

Browse files
committed
Changed macro_backtrace() to in_macro().
1 parent b5587a8 commit a77bcad

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clippy_lints/src/implicit_return.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass};
1212
use crate::rustc::{declare_tool_lint, lint_array};
1313
use crate::rustc_errors::Applicability;
1414
use crate::syntax::{ast::NodeId, source_map::Span};
15-
use crate::utils::{snippet_opt, span_lint_and_then};
15+
use crate::utils::{snippet_opt, span_lint_and_then, in_macro};
1616

1717
/// **What it does:** Checks for missing return statements at the end of a block.
1818
///
@@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
124124

125125
// checking return type through MIR, HIR is not able to determine inferred closure return types
126126
// make sure it's not a macro
127-
if !mir.return_ty().is_unit() && span.macro_backtrace().is_empty() {
127+
if !mir.return_ty().is_unit() && !in_macro(span) {
128128
Self::expr_match(cx, &body.value);
129129
}
130130
}

clippy_lints/src/loops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ impl LintPass for Pass {
479479
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass {
480480
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) {
481481
// we don't want to check expanded macros
482-
if !expr.span.macro_backtrace().is_empty() {
482+
if !in_macro(expr.span) {
483483
return;
484484
}
485485

0 commit comments

Comments
 (0)