Skip to content

Commit e8b78e2

Browse files
committed
Auto merge of #13630 - samueltardieu:push-qrnxuykslnsl, r=y21
Use match ergonomics compatible with editions 2021 and 2024 This PR contains the minimal changes needed to make Clippy match ergonomics work with both Rust 2021 and Rust 2024. changelog: none
2 parents 9d03956 + 0c1ef98 commit e8b78e2

33 files changed

Lines changed: 66 additions & 69 deletions

‎clippy_lints/src/checked_conversions.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn get_types_from_cast<'a>(
232232
// or `to_type::MAX as from_type`
233233
let call_from_cast:Option<(&Expr<'_>,&str)> = ifletExprKind::Cast(limit, from_type) = &expr.kind
234234
// to_type::max_value(), from_type
235-
&& letTyKind::Path(reffrom_type_path) = &from_type.kind
235+
&& letTyKind::Path(from_type_path) = &from_type.kind
236236
&& letSome(from_sym) = int_ty_to_sym(from_type_path)
237237
{
238238
Some((limit, from_sym))
@@ -245,7 +245,7 @@ fn get_types_from_cast<'a>(
245245
ifletExprKind::Call(from_func,[limit]) = &expr.kind
246246
// `from_type::from, to_type::max_value()`
247247
// `from_type::from`
248-
&& letExprKind::Path(refpath) = &from_func.kind
248+
&& letExprKind::Path(path) = &from_func.kind
249249
&& letSome(from_sym) = get_implementing_type(path,INTS,"from")
250250
{
251251
Some((limit, from_sym))

‎clippy_lints/src/copy_iterator.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass!(CopyIterator => [COPY_ITERATOR]);
3737
impl<'tcx>LateLintPass<'tcx>forCopyIterator{
3838
fncheck_item(&mutself,cx:&LateContext<'tcx>,item:&'tcxItem<'_>){
3939
ifletItemKind::Impl(Impl{
40-
of_trait:Some(reftrait_ref),
40+
of_trait:Some(trait_ref),
4141
..
4242
}) = item.kind
4343
&& let ty = cx.tcx.type_of(item.owner_id).instantiate_identity()

‎clippy_lints/src/derivable_impls.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ fn check_enum<'tcx>(cx: &LateContext<'tcx>, item: &'tcx Item<'_>, func_expr: &Ex
187187
impl<'tcx>LateLintPass<'tcx>forDerivableImpls{
188188
fncheck_item(&mutself,cx:&LateContext<'tcx>,item:&'tcxItem<'_>){
189189
ifletItemKind::Impl(Impl{
190-
of_trait:Some(reftrait_ref),
190+
of_trait:Some(trait_ref),
191191
items:[child],
192192
self_ty,
193193
..

‎clippy_lints/src/derive.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ declare_lint_pass!(Derive => [
202202
impl<'tcx>LateLintPass<'tcx>forDerive{
203203
fncheck_item(&mutself,cx:&LateContext<'tcx>,item:&'tcxItem<'_>){
204204
ifletItemKind::Impl(Impl{
205-
of_trait:Some(reftrait_ref),
205+
of_trait:Some(trait_ref),
206206
..
207207
}) = item.kind
208208
{

‎clippy_lints/src/disallowed_script_idents.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ impl EarlyLintPass for DisallowedScriptIdents {
8080
letmut symbols:Vec<_> = symbols.iter().collect();
8181
symbols.sort_unstable_by_key(|k| k.1);
8282

83-
for(symbol,&span)in&symbols {
83+
for&(symbol,&span)in&symbols {
8484
// Note: `symbol.as_str()` is an expensive operation, thus should not be called
8585
// more than once for a single symbol.
8686
let symbol_str = symbol.as_str();

‎clippy_lints/src/empty_drop.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ declare_lint_pass!(EmptyDrop => [EMPTY_DROP]);
3636
implLateLintPass<'_>forEmptyDrop{
3737
fncheck_item(&mutself,cx:&LateContext<'_>,item:&Item<'_>){
3838
ifletItemKind::Impl(Impl{
39-
of_trait:Some(reftrait_ref),
39+
of_trait:Some(trait_ref),
4040
items:[child],
4141
..
4242
}) = item.kind

‎clippy_lints/src/len_zero.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,7 @@ fn has_is_empty(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
629629
.filter_by_name_unhygienic(is_empty)
630630
.any(|item| is_is_empty(cx, item))
631631
}),
632-
ty::Alias(ty::Projection,refproj) => has_is_empty_impl(cx, proj.def_id),
632+
ty::Alias(ty::Projection, proj) => has_is_empty_impl(cx, proj.def_id),
633633
ty::Adt(id, _) => has_is_empty_impl(cx, id.did()),
634634
ty::Array(..) | ty::Slice(..) | ty::Str => true,
635635
_ => false,

‎clippy_lints/src/lifetimes.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
425425
self.visit_opaque_ty(opaque);
426426
self.lts.truncate(len);
427427
self.lts.extend(bounds.iter().filter_map(|bound| match bound {
428-
GenericArg::Lifetime(&l) => Some(l),
428+
&GenericArg::Lifetime(l) => Some(l),
429429
_ => None,
430430
}));
431431
},

‎clippy_lints/src/manual_async_fn.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn captures_all_lifetimes(inputs: &[Ty<'_>], output_lifetimes: &[LifetimeName])
169169
}
170170

171171
fndesugared_async_block<'tcx>(cx:&LateContext<'tcx>,block:&'tcxBlock<'tcx>) -> Option<&'tcxBody<'tcx>>{
172-
ifletSome(Expr{
172+
ifletSome(&Expr{
173173
kind:ExprKind::Closure(&Closure{ kind, body, .. }),
174174
..
175175
}) = block.expr

‎clippy_lints/src/matches/match_like_matches.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ fn find_bool_lit(ex: &ExprKind<'_>) -> Option<bool> {
148148
}) => Some(*b),
149149
ExprKind::Block(
150150
rustc_hir::Block{
151-
stmts:&[],
151+
stmts:[],
152152
expr:Some(exp),
153153
..
154154
},

0 commit comments

Comments
 (0)