From 32304d14a1a5e316615028ffd7bcfcff682fbe56 Mon Sep 17 00:00:00 2001 From: Alexandru Macovei Date: Wed, 31 Mar 2021 00:55:18 +0300 Subject: Use Box'es to reduce the size of hir_def::expr::Pat from 112 to 64 bytes on 64bit --- crates/hir_def/src/body/lower.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_def/src/body') diff --git a/crates/hir_def/src/body/lower.rs b/crates/hir_def/src/body/lower.rs index 73e7aee33..1e743e5d5 100644 --- a/crates/hir_def/src/body/lower.rs +++ b/crates/hir_def/src/body/lower.rs @@ -759,7 +759,7 @@ impl ExprCollector<'_> { } } ast::Pat::TupleStructPat(p) => { - let path = p.path().and_then(|path| self.expander.parse_path(path)); + let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new); let (args, ellipsis) = self.collect_tuple_pat(p.fields()); Pat::TupleStruct { path, args, ellipsis } } @@ -769,7 +769,7 @@ impl ExprCollector<'_> { Pat::Ref { pat, mutability } } ast::Pat::PathPat(p) => { - let path = p.path().and_then(|path| self.expander.parse_path(path)); + let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new); path.map(Pat::Path).unwrap_or(Pat::Missing) } ast::Pat::OrPat(p) => { @@ -783,7 +783,7 @@ impl ExprCollector<'_> { } ast::Pat::WildcardPat(_) => Pat::Wild, ast::Pat::RecordPat(p) => { - let path = p.path().and_then(|path| self.expander.parse_path(path)); + let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new); let args: Vec<_> = p .record_pat_field_list() .expect("every struct should have a field list") -- cgit v1.2.3