Skip to content

Commit 4c2aef6

Browse files
committed
Slim down AssociatedTypeBinding by one usize
1 parent 41db8c2 commit 4c2aef6

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

crates/hir-def/src/item_tree/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ fn desugar_future_path(orig: TypeRef) -> Path {
664664
name: name![Output],
665665
args: None,
666666
type_ref: Some(orig),
667-
bounds: Vec::new(),
667+
bounds: Box::default(),
668668
};
669669
last.bindings.push(binding);
670670
generic_args.push(Some(Interned::new(last)));

crates/hir-def/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ pub struct AssociatedTypeBinding {
7777
/// Bounds for the associated type, like in `Iterator<Item:
7878
/// SomeOtherTrait>`. (This is the unstable `associated_type_bounds`
7979
/// feature.)
80-
pub bounds: Vec<Interned<TypeBound>>,
80+
pub bounds: Box<[Interned<TypeBound>]>,
8181
}
8282

8383
/// A single generic argument.

crates/hir-def/src/path/lower.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ pub(super) fn lower_generic_args(
187187
.map(|it| Interned::new(TypeBound::from_ast(lower_ctx, it)))
188188
.collect()
189189
} else {
190-
Vec::new()
190+
Box::default()
191191
};
192192
bindings.push(AssociatedTypeBinding { name, args, type_ref, bounds });
193193
}
@@ -234,7 +234,7 @@ fn lower_generic_args_from_fn_path(
234234
name: name![Output],
235235
args: None,
236236
type_ref: Some(type_ref),
237-
bounds: Vec::new(),
237+
bounds: Box::default(),
238238
});
239239
} else {
240240
// -> ()
@@ -243,7 +243,7 @@ fn lower_generic_args_from_fn_path(
243243
name: name![Output],
244244
args: None,
245245
type_ref: Some(type_ref),
246-
bounds: Vec::new(),
246+
bounds: Box::default(),
247247
});
248248
}
249249
Some(GenericArgs { args, has_self_type: false, bindings, desugared_from_fn: true })

crates/hir-def/src/type_ref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ impl TypeRef {
305305
if let Some(type_ref) = &binding.type_ref {
306306
go(type_ref, f);
307307
}
308-
for bound in &binding.bounds {
308+
for bound in binding.bounds.iter() {
309309
match bound.as_ref() {
310310
TypeBound::Path(path, _) | TypeBound::ForLifetime(_, path) => {
311311
go_path(path, f)

crates/hir-ty/src/display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1445,7 +1445,7 @@ impl HirDisplay for Path {
14451445
}
14461446
None => {
14471447
write!(f, ": ")?;
1448-
f.write_joined(&binding.bounds, " + ")?;
1448+
f.write_joined(binding.bounds.iter(), " + ")?;
14491449
}
14501450
}
14511451
}

crates/hir-ty/src/lower.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1068,7 +1068,7 @@ impl<'a> TyLoweringContext<'a> {
10681068
AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty };
10691069
preds.push(crate::wrap_empty_binders(WhereClause::AliasEq(alias_eq)));
10701070
}
1071-
for bound in &binding.bounds {
1071+
for bound in binding.bounds.iter() {
10721072
preds.extend(self.lower_type_bound(
10731073
bound,
10741074
TyKind::Alias(AliasTy::Projection(projection_ty.clone())).intern(Interner),

0 commit comments

Comments
 (0)