diff options
| author | daxpedda <daxpedda@users.noreply.github.com> | 2018-12-25 12:48:54 +0100 |
|---|---|---|
| committer | daxpedda <daxpedda@users.noreply.github.com> | 2018-12-25 12:48:54 +0100 |
| commit | a77bcadaa55801cc870ef740ca0d9fa4ca45df42 (patch) | |
| tree | 089e36337ec5541886e3b6f2fbf3bd609745330d | |
| parent | b5587a894f34e77b103947d37594c91ce124a2c0 (diff) | |
| download | rust-a77bcadaa55801cc870ef740ca0d9fa4ca45df42.tar.gz rust-a77bcadaa55801cc870ef740ca0d9fa4ca45df42.zip | |
Changed `macro_backtrace()` to `in_macro()`.
| -rw-r--r-- | clippy_lints/src/implicit_return.rs | 4 | ||||
| -rw-r--r-- | clippy_lints/src/loops.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index ee64c01b385..912ed43aab3 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -12,7 +12,7 @@ use crate::rustc::lint::{LateContext, LateLintPass, LintArray, LintPass}; use crate::rustc::{declare_tool_lint, lint_array}; use crate::rustc_errors::Applicability; use crate::syntax::{ast::NodeId, source_map::Span}; -use crate::utils::{snippet_opt, span_lint_and_then}; +use crate::utils::{snippet_opt, span_lint_and_then, in_macro}; /// **What it does:** Checks for missing return statements at the end of a block. /// @@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { // checking return type through MIR, HIR is not able to determine inferred closure return types // make sure it's not a macro - if !mir.return_ty().is_unit() && span.macro_backtrace().is_empty() { + if !mir.return_ty().is_unit() && !in_macro(span) { Self::expr_match(cx, &body.value); } } diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 66a54ad2443..66f85e88398 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -479,7 +479,7 @@ impl LintPass for Pass { impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr) { // we don't want to check expanded macros - if !expr.span.macro_backtrace().is_empty() { + if !in_macro(expr.span) { return; } |
