aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_def/src/body
diff options
context:
space:
mode:
authorAlexandru Macovei <[email protected]>2021-03-30 22:55:18 +0100
committerAlexandru Macovei <[email protected]>2021-04-06 14:01:31 +0100
commit32304d14a1a5e316615028ffd7bcfcff682fbe56 (patch)
tree4dda8757645c339a0ea6a926456ce7edf4ec4de7 /crates/hir_def/src/body
parentfb1f544e2479addd5957688e297ea04ddf0cf249 (diff)
Use Box'es to reduce the size of hir_def::expr::Pat from 112 to 64 bytes on 64bit
Diffstat (limited to 'crates/hir_def/src/body')
-rw-r--r--crates/hir_def/src/body/lower.rs6
1 files changed, 3 insertions, 3 deletions
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<'_> {
759 } 759 }
760 } 760 }
761 ast::Pat::TupleStructPat(p) => { 761 ast::Pat::TupleStructPat(p) => {
762 let path = p.path().and_then(|path| self.expander.parse_path(path)); 762 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
763 let (args, ellipsis) = self.collect_tuple_pat(p.fields()); 763 let (args, ellipsis) = self.collect_tuple_pat(p.fields());
764 Pat::TupleStruct { path, args, ellipsis } 764 Pat::TupleStruct { path, args, ellipsis }
765 } 765 }
@@ -769,7 +769,7 @@ impl ExprCollector<'_> {
769 Pat::Ref { pat, mutability } 769 Pat::Ref { pat, mutability }
770 } 770 }
771 ast::Pat::PathPat(p) => { 771 ast::Pat::PathPat(p) => {
772 let path = p.path().and_then(|path| self.expander.parse_path(path)); 772 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
773 path.map(Pat::Path).unwrap_or(Pat::Missing) 773 path.map(Pat::Path).unwrap_or(Pat::Missing)
774 } 774 }
775 ast::Pat::OrPat(p) => { 775 ast::Pat::OrPat(p) => {
@@ -783,7 +783,7 @@ impl ExprCollector<'_> {
783 } 783 }
784 ast::Pat::WildcardPat(_) => Pat::Wild, 784 ast::Pat::WildcardPat(_) => Pat::Wild,
785 ast::Pat::RecordPat(p) => { 785 ast::Pat::RecordPat(p) => {
786 let path = p.path().and_then(|path| self.expander.parse_path(path)); 786 let path = p.path().and_then(|path| self.expander.parse_path(path)).map(Box::new);
787 let args: Vec<_> = p 787 let args: Vec<_> = p
788 .record_pat_field_list() 788 .record_pat_field_list()
789 .expect("every struct should have a field list") 789 .expect("every struct should have a field list")