Skip to content

Commit a25b386

Browse files
committed
cleanup + fix warnings
1 parent c3f24f0 commit a25b386

File tree

4 files changed

+3
-4
lines changed

4 files changed

+3
-4
lines changed

clippy_lints/src/eta_reduction.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fn check_clousure<'tcx>(cx: &LateContext<'tcx>, outer_receiver: Option<&Expr<'tc
196196
{
197197
span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure", |diag| {
198198
if let Some(mut snippet) = snippet_opt(cx, callee.span) {
199-
if path_to_local(callee).map_or(false, |l| {
199+
if path_to_local(callee).is_some_and(|l| {
200200
// FIXME: Do we really need this `local_used_in` check?
201201
// Isn't it checking something like... `callee(callee)`?
202202
// If somehow this check is needed, add some test for it,

clippy_lints/src/matches/single_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ impl<'tcx> Visitor<'tcx> for PatVisitor<'tcx> {
176176
if matches!(pat.kind, PatKind::Binding(..)) {
177177
ControlFlow::Break(())
178178
} else {
179-
self.has_enum |= self.typeck.pat_ty(pat).ty_adt_def().map_or(false, AdtDef::is_enum);
179+
self.has_enum |= self.typeck.pat_ty(pat).ty_adt_def().is_some_and(AdtDef::is_enum);
180180
walk_pat(self, pat)
181181
}
182182
}

clippy_lints/src/methods/unnecessary_map_or.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use clippy_utils::source::{snippet, snippet_opt};
55
use clippy_utils::ty::is_type_diagnostic_item;
66
use clippy_utils::visitors::is_local_used;
77
use clippy_utils::{get_parent_expr, is_from_proc_macro, path_to_local_id};
8-
use rustc_ast::util::parser::AssocOp;
98
use rustc_ast::LitKind::Bool;
9+
use rustc_ast::util::parser::AssocOp;
1010
use rustc_errors::Applicability;
1111
use rustc_hir::{BinOpKind, Expr, ExprKind, PatKind};
1212
use rustc_lint::LateContext;

clippy_lints/src/redundant_slicing.rs

-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,6 @@ impl<'tcx> LateLintPass<'tcx> for RedundantSlicing {
8686
let (indexed_ty, indexed_ref_count) = peel_middle_ty_refs(cx.typeck_results().expr_ty(indexed));
8787
let parent_expr = get_parent_expr(cx, expr);
8888
let needs_parens_for_prefix = parent_expr.is_some_and(|parent| parent.precedence().order() > PREC_PREFIX);
89-
let mut app = Applicability::MachineApplicable;
9089

9190
if expr_ty == indexed_ty {
9291
if expr_ref_count > indexed_ref_count {

0 commit comments

Comments
 (0)