about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLukas Wirth <lukastw97@gmail.com>2023-02-14 17:18:46 +0100
committerLukas Wirth <lukastw97@gmail.com>2023-02-14 17:40:24 +0100
commit4c2aef650ae115d0fc504d0511a4f4809d625050 (patch)
tree1902febb7dd4d94e6521cd654a7229dfb3d0781c
parent41db8c2b5935ac876b7f16fd361809a725edcc55 (diff)
downloadrust-4c2aef650ae115d0fc504d0511a4f4809d625050.tar.gz
rust-4c2aef650ae115d0fc504d0511a4f4809d625050.zip
Slim down AssociatedTypeBinding by one usize
-rw-r--r--crates/hir-def/src/item_tree/lower.rs2
-rw-r--r--crates/hir-def/src/path.rs2
-rw-r--r--crates/hir-def/src/path/lower.rs6
-rw-r--r--crates/hir-def/src/type_ref.rs2
-rw-r--r--crates/hir-ty/src/display.rs2
-rw-r--r--crates/hir-ty/src/lower.rs2
6 files changed, 8 insertions, 8 deletions
diff --git a/crates/hir-def/src/item_tree/lower.rs b/crates/hir-def/src/item_tree/lower.rs
index 27705cbbbdc..e8653274cf4 100644
--- a/crates/hir-def/src/item_tree/lower.rs
+++ b/crates/hir-def/src/item_tree/lower.rs
@@ -664,7 +664,7 @@ fn desugar_future_path(orig: TypeRef) -> Path {
         name: name![Output],
         args: None,
         type_ref: Some(orig),
-        bounds: Vec::new(),
+        bounds: Box::default(),
     };
     last.bindings.push(binding);
     generic_args.push(Some(Interned::new(last)));
diff --git a/crates/hir-def/src/path.rs b/crates/hir-def/src/path.rs
index f53bd4f6186..b9e79fd462e 100644
--- a/crates/hir-def/src/path.rs
+++ b/crates/hir-def/src/path.rs
@@ -77,7 +77,7 @@ pub struct AssociatedTypeBinding {
     /// Bounds for the associated type, like in `Iterator<Item:
     /// SomeOtherTrait>`. (This is the unstable `associated_type_bounds`
     /// feature.)
-    pub bounds: Vec<Interned<TypeBound>>,
+    pub bounds: Box<[Interned<TypeBound>]>,
 }
 
 /// A single generic argument.
diff --git a/crates/hir-def/src/path/lower.rs b/crates/hir-def/src/path/lower.rs
index 334750a5915..51f1ba79a47 100644
--- a/crates/hir-def/src/path/lower.rs
+++ b/crates/hir-def/src/path/lower.rs
@@ -187,7 +187,7 @@ pub(super) fn lower_generic_args(
                             .map(|it| Interned::new(TypeBound::from_ast(lower_ctx, it)))
                             .collect()
                     } else {
-                        Vec::new()
+                        Box::default()
                     };
                     bindings.push(AssociatedTypeBinding { name, args, type_ref, bounds });
                 }
@@ -234,7 +234,7 @@ fn lower_generic_args_from_fn_path(
             name: name![Output],
             args: None,
             type_ref: Some(type_ref),
-            bounds: Vec::new(),
+            bounds: Box::default(),
         });
     } else {
         // -> ()
@@ -243,7 +243,7 @@ fn lower_generic_args_from_fn_path(
             name: name![Output],
             args: None,
             type_ref: Some(type_ref),
-            bounds: Vec::new(),
+            bounds: Box::default(),
         });
     }
     Some(GenericArgs { args, has_self_type: false, bindings, desugared_from_fn: true })
diff --git a/crates/hir-def/src/type_ref.rs b/crates/hir-def/src/type_ref.rs
index 8fa12c7aafd..51b6c4d10b1 100644
--- a/crates/hir-def/src/type_ref.rs
+++ b/crates/hir-def/src/type_ref.rs
@@ -305,7 +305,7 @@ impl TypeRef {
                         if let Some(type_ref) = &binding.type_ref {
                             go(type_ref, f);
                         }
-                        for bound in &binding.bounds {
+                        for bound in binding.bounds.iter() {
                             match bound.as_ref() {
                                 TypeBound::Path(path, _) | TypeBound::ForLifetime(_, path) => {
                                     go_path(path, f)
diff --git a/crates/hir-ty/src/display.rs b/crates/hir-ty/src/display.rs
index 5fcbdf34f3c..1f2e56f5bd3 100644
--- a/crates/hir-ty/src/display.rs
+++ b/crates/hir-ty/src/display.rs
@@ -1445,7 +1445,7 @@ impl HirDisplay for Path {
                         }
                         None => {
                             write!(f, ": ")?;
-                            f.write_joined(&binding.bounds, " + ")?;
+                            f.write_joined(binding.bounds.iter(), " + ")?;
                         }
                     }
                 }
diff --git a/crates/hir-ty/src/lower.rs b/crates/hir-ty/src/lower.rs
index 7cce13a793e..f93d710e1aa 100644
--- a/crates/hir-ty/src/lower.rs
+++ b/crates/hir-ty/src/lower.rs
@@ -1068,7 +1068,7 @@ impl<'a> TyLoweringContext<'a> {
                         AliasEq { alias: AliasTy::Projection(projection_ty.clone()), ty };
                     preds.push(crate::wrap_empty_binders(WhereClause::AliasEq(alias_eq)));
                 }
-                for bound in &binding.bounds {
+                for bound in binding.bounds.iter() {
                     preds.extend(self.lower_type_bound(
                         bound,
                         TyKind::Alias(AliasTy::Projection(projection_ty.clone())).intern(Interner),