mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-22 12:43:36 +00:00
don't lint external macro expansions
This commit is contained in:
parent
2a41d40807
commit
27c0d6c14b
@ -2,7 +2,7 @@ use if_chain::if_chain;
|
||||
use rustc_errors::Applicability;
|
||||
use rustc_hir::{Expr, ExprKind, LangItem};
|
||||
use rustc_lint::{LateContext, LateLintPass};
|
||||
use rustc_middle::ty::TyS;
|
||||
use rustc_middle::{lint::in_external_macro, ty::TyS};
|
||||
use rustc_session::{declare_lint_pass, declare_tool_lint};
|
||||
|
||||
use crate::utils::{is_type_lang_item, snippet_with_applicability, span_lint_and_sugg};
|
||||
@ -39,6 +39,10 @@ declare_lint_pass!(RedundantSlicing => [REDUNDANT_SLICING]);
|
||||
|
||||
impl LateLintPass<'_> for RedundantSlicing {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
|
||||
if in_external_macro(cx.sess, expr.span) {
|
||||
return;
|
||||
}
|
||||
|
||||
if_chain! {
|
||||
if let ExprKind::AddrOf(_, _, addressee) = expr.kind;
|
||||
if let ExprKind::Index(indexed, range) = addressee.kind;
|
||||
|
Loading…
Reference in New Issue
Block a user