index_refutable_slice
: Check HIR tree first.
This commit is contained in:
parent
b58b491d16
commit
06f83b4e26
@ -70,8 +70,8 @@ pub fn new(max_suggested_slice_pattern_length: u64, msrv: Msrv) -> Self {
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for IndexRefutableSlice {
|
||||
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'_>) {
|
||||
if (!expr.span.from_expansion() || is_expn_of(expr.span, "if_chain").is_some())
|
||||
&& let Some(IfLet { let_pat, if_then, .. }) = IfLet::hir(cx, expr)
|
||||
if let Some(IfLet { let_pat, if_then, .. }) = IfLet::hir(cx, expr)
|
||||
&& (!expr.span.from_expansion() || is_expn_of(expr.span, "if_chain").is_some())
|
||||
&& !is_lint_allowed(cx, INDEX_REFUTABLE_SLICE, expr.hir_id)
|
||||
&& self.msrv.meets(msrvs::SLICE_PATTERNS)
|
||||
&& let found_slices = find_slice_values(cx, let_pat)
|
||||
|
Loading…
Reference in New Issue
Block a user