Skip to content

Commit 4415411

Browse files
samueltardieuflip1995
authored andcommitted
Use match ergonomics compatible with editions 2021 and 2024
1 parent 7c5d752 commit 4415411

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

clippy_lints/src/trait_bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ impl<'tcx> LateLintPass<'tcx> for TraitBounds {
124124
let mut self_bounds_map = FxHashMap::default();
125125

126126
for predicate in item.generics.predicates {
127-
if let WherePredicate::BoundPredicate(ref bound_predicate) = predicate
127+
if let WherePredicate::BoundPredicate(bound_predicate) = predicate
128128
&& bound_predicate.origin != PredicateOrigin::ImplTrait
129129
&& !bound_predicate.span.from_expansion()
130130
&& let TyKind::Path(QPath::Resolved(_, Path { segments, .. })) = bound_predicate.bounded_ty.kind
@@ -268,7 +268,7 @@ impl TraitBounds {
268268
let mut map: UnhashMap<SpanlessTy<'_, '_>, Vec<&GenericBound<'_>>> = UnhashMap::default();
269269
let mut applicability = Applicability::MaybeIncorrect;
270270
for bound in generics.predicates {
271-
if let WherePredicate::BoundPredicate(ref p) = bound
271+
if let WherePredicate::BoundPredicate(p) = bound
272272
&& p.origin != PredicateOrigin::ImplTrait
273273
&& p.bounds.len() as u64 <= self.max_trait_bounds
274274
&& !p.span.from_expansion()

clippy_lints/src/unused_io_amount.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ fn unpack_call_chain<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
244244
}
245245

246246
fn unpack_try<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
247-
while let ExprKind::Call(func, [ref arg_0]) = expr.kind
247+
while let ExprKind::Call(func, [arg_0]) = expr.kind
248248
&& matches!(
249249
func.kind,
250250
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::TryTraitBranch, ..))
@@ -266,7 +266,7 @@ fn unpack_match<'a>(mut expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
266266
/// waited on. Otherwise return None.
267267
fn unpack_await<'a>(expr: &'a hir::Expr<'a>) -> &'a hir::Expr<'a> {
268268
if let ExprKind::Match(expr, _, hir::MatchSource::AwaitDesugar) = expr.kind {
269-
if let ExprKind::Call(func, [ref arg_0]) = expr.kind {
269+
if let ExprKind::Call(func, [arg_0]) = expr.kind {
270270
if matches!(
271271
func.kind,
272272
ExprKind::Path(hir::QPath::LangItem(hir::LangItem::IntoFutureIntoFuture, ..))

clippy_lints/src/utils/internal_lints/collapsible_calls.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ impl<'tcx> LateLintPass<'tcx> for CollapsibleCalls {
7979

8080
if let ExprKind::Call(func, [call_cx, call_lint, call_sp, call_msg, call_f]) = expr.kind
8181
&& is_expr_path_def_path(cx, func, &["clippy_utils", "diagnostics", "span_lint_and_then"])
82-
&& let ExprKind::Closure(&Closure { body, .. }) = &call_f.kind
82+
&& let ExprKind::Closure(&Closure { body, .. }) = call_f.kind
8383
&& let body = cx.tcx.hir().body(body)
8484
&& let only_expr = peel_blocks_with_stmt(body.value)
8585
&& let ExprKind::MethodCall(ps, recv, span_call_args, _) = &only_expr.kind

clippy_utils/src/hir_utils.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1201,11 +1201,11 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12011201
self.hash_ty(ty);
12021202
self.hash_pat(pat);
12031203
},
1204-
TyKind::Ptr(ref mut_ty) => {
1204+
TyKind::Ptr(mut_ty) => {
12051205
self.hash_ty(mut_ty.ty);
12061206
mut_ty.mutbl.hash(&mut self.s);
12071207
},
1208-
TyKind::Ref(lifetime, ref mut_ty) => {
1208+
TyKind::Ref(lifetime, mut_ty) => {
12091209
self.hash_lifetime(lifetime);
12101210
self.hash_ty(mut_ty.ty);
12111211
mut_ty.mutbl.hash(&mut self.s);
@@ -1230,7 +1230,7 @@ impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
12301230
self.hash_ty(ty);
12311231
}
12321232
},
1233-
TyKind::Path(ref qpath) => self.hash_qpath(qpath),
1233+
TyKind::Path(qpath) => self.hash_qpath(qpath),
12341234
TyKind::TraitObject(_, lifetime, _) => {
12351235
self.hash_lifetime(lifetime);
12361236
},

0 commit comments

Comments
 (0)