diff options
| author | Samuel Tardieu <sam@rfc1149.net> | 2024-10-29 19:48:09 +0100 |
|---|---|---|
| committer | Samuel Tardieu <sam@rfc1149.net> | 2024-10-30 09:28:37 +0100 |
| commit | a3047098b63953961a8bc837ce24b3b84bf3e34c (patch) | |
| tree | 01040a1c256eb11d81f012ae578e1869ff38a704 | |
| parent | 625d391107d2c8bffe7808a6f66564591821a160 (diff) | |
| download | rust-a3047098b63953961a8bc837ce24b3b84bf3e34c.tar.gz rust-a3047098b63953961a8bc837ce24b3b84bf3e34c.zip | |
Do not use `gen` as a variable name
`gen` will be a reserved word in Rust 2024.
| -rw-r--r-- | clippy_lints/src/functions/ref_option.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clippy_lints/src/functions/ref_option.rs b/clippy_lints/src/functions/ref_option.rs index 373ecd74cb3..aba0fbcb9fe 100644 --- a/clippy_lints/src/functions/ref_option.rs +++ b/clippy_lints/src/functions/ref_option.rs @@ -15,9 +15,9 @@ use rustc_span::{Span, sym}; fn check_ty<'a>(cx: &LateContext<'a>, param: &rustc_hir::Ty<'a>, param_ty: Ty<'a>, fixes: &mut Vec<(Span, String)>) { if let ty::Ref(_, opt_ty, Mutability::Not) = param_ty.kind() && is_type_diagnostic_item(cx, *opt_ty, sym::Option) - && let ty::Adt(_, opt_gen) = opt_ty.kind() - && let [gen] = opt_gen.as_slice() - && let GenericArgKind::Type(gen_ty) = gen.unpack() + && let ty::Adt(_, opt_gen_args) = opt_ty.kind() + && let [gen_arg] = opt_gen_args.as_slice() + && let GenericArgKind::Type(gen_ty) = gen_arg.unpack() && !gen_ty.is_ref() // Need to gen the original spans, so first parsing mid, and hir parsing afterward && let hir::TyKind::Ref(lifetime, hir::MutTy { ty, .. }) = param.kind |
