From ceaec9d8666614f6e84506b84f4b740538cb6d50 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 20 Nov 2021 16:17:16 +0100 Subject: [PATCH] internal: Replace Vec with Box in hir Pat --- crates/hir_def/src/body/lower.rs | 6 +-- crates/hir_def/src/expr.rs | 66 +++++++++++++------------------- crates/hir_ty/src/infer/pat.rs | 8 ++-- 3 files changed, 33 insertions(+), 47 deletions(-) diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 48aa1b3464b..e322a953844 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -813,7 +813,7 @@ impl ExprCollector<'_> { ast::Pat::RecordPat(p) => { let path = p.path().and_then(|path| self.expander.parse_path(self.db, path)).map(Box::new); - let args: Vec<_> = p + let args = p .record_pat_field_list() .expect("every struct should have a field list") .fields() @@ -903,7 +903,7 @@ impl ExprCollector<'_> { } } - fn collect_tuple_pat(&mut self, args: AstChildren) -> (Vec, Option) { + fn collect_tuple_pat(&mut self, args: AstChildren) -> (Box<[PatId]>, Option) { // Find the location of the `..`, if there is one. Note that we do not // consider the possibility of there being multiple `..` here. let ellipsis = args.clone().position(|p| matches!(p, ast::Pat::RestPat(_))); @@ -962,7 +962,7 @@ impl From for Literal { Literal::Float(Default::default(), ty) } LiteralKind::ByteString(bs) => { - let text = bs.value().map(Vec::from).unwrap_or_else(Default::default); + let text = bs.value().map(Box::from).unwrap_or_else(Default::default); Literal::ByteString(text) } LiteralKind::String(_) => Literal::String(Default::default()), diff --git a/crates/hir_def/src/expr.rs b/crates/hir_def/src/expr.rs index 587a5ce46d4..e6518c3e2d7 100644 --- a/crates/hir_def/src/expr.rs +++ b/crates/hir_def/src/expr.rs @@ -41,7 +41,7 @@ pub type LabelId = Idx