Rollup merge of #124224 - bvanjoi:cleanup, r=fmease

cleanup: unnecessary clone during lower generics args
This commit is contained in:
Matthias Krüger 2024-04-21 21:56:32 +02:00 committed by GitHub
commit cd92422180
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -228,8 +228,8 @@ pub fn lower_generic_args<'tcx: 'a, 'a>(
// Check whether this segment takes generic arguments and the user has provided any. // Check whether this segment takes generic arguments and the user has provided any.
let (generic_args, infer_args) = ctx.args_for_def_id(def_id); let (generic_args, infer_args) = ctx.args_for_def_id(def_id);
let args_iter = generic_args.iter().flat_map(|generic_args| generic_args.args.iter()); let mut args_iter =
let mut args_iter = args_iter.clone().peekable(); generic_args.iter().flat_map(|generic_args| generic_args.args.iter()).peekable();
// If we encounter a type or const when we expect a lifetime, we infer the lifetimes. // If we encounter a type or const when we expect a lifetime, we infer the lifetimes.
// If we later encounter a lifetime, we know that the arguments were provided in the // If we later encounter a lifetime, we know that the arguments were provided in the