mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 08:13:41 +00:00
Directly collect into ty_param_names instead of peeking to see if empty
This commit is contained in:
parent
bd2b53ba6d
commit
45363f11ef
@ -695,15 +695,13 @@ impl<'a> TraitDef<'a> {
|
||||
}
|
||||
}));
|
||||
|
||||
let mut ty_params = params
|
||||
let ty_param_names: Vec<Symbol> = params
|
||||
.iter()
|
||||
.filter(|param| matches!(param.kind, ast::GenericParamKind::Type { .. }))
|
||||
.peekable();
|
||||
|
||||
if ty_params.peek().is_some() {
|
||||
let ty_param_names: Vec<Symbol> =
|
||||
ty_params.map(|ty_param| ty_param.ident.name).collect();
|
||||
.map(|ty_param| ty_param.ident.name)
|
||||
.collect();
|
||||
|
||||
if !ty_param_names.is_empty() {
|
||||
for field_ty in field_tys {
|
||||
let field_ty_params = find_type_parameters(&field_ty, &ty_param_names, cx);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user