aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_expand/src
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-03-16 11:22:10 +0000
committerFlorian Diebold <[email protected]>2020-03-16 17:38:19 +0000
commitd655749aaeb31461f9af923bbf0b36d219cff343 (patch)
treed7f8e8a11bd4794567fb24ac29b2b85ebd247881 /crates/ra_hir_expand/src
parentf3c6a2e3dbe477a7e0ac714a5bdbda6e8838fcfa (diff)
Turn ExpandResult into struct
Diffstat (limited to 'crates/ra_hir_expand/src')
-rw-r--r--crates/ra_hir_expand/src/db.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/crates/ra_hir_expand/src/db.rs b/crates/ra_hir_expand/src/db.rs
index f1918817e..d171d2dfd 100644
--- a/crates/ra_hir_expand/src/db.rs
+++ b/crates/ra_hir_expand/src/db.rs
@@ -2,7 +2,7 @@
2 2
3use std::sync::Arc; 3use std::sync::Arc;
4 4
5use mbe::MacroRules; 5use mbe::{ExpandResult, MacroRules};
6use ra_db::{salsa, SourceDatabase}; 6use ra_db::{salsa, SourceDatabase};
7use ra_parser::FragmentKind; 7use ra_parser::FragmentKind;
8use ra_prof::profile; 8use ra_prof::profile;
@@ -31,12 +31,8 @@ impl TokenExpander {
31 match self { 31 match self {
32 TokenExpander::MacroRules(it) => it.expand(tt), 32 TokenExpander::MacroRules(it) => it.expand(tt),
33 // FIXME switch these to ExpandResult as well 33 // FIXME switch these to ExpandResult as well
34 TokenExpander::Builtin(it) => it 34 TokenExpander::Builtin(it) => it.expand(db, id, tt).into(),
35 .expand(db, id, tt) 35 TokenExpander::BuiltinDerive(it) => it.expand(db, id, tt).into(),
36 .map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)),
37 TokenExpander::BuiltinDerive(it) => it
38 .expand(db, id, tt)
39 .map_or_else(|e| (tt::Subtree::default(), Some(e)), |r| (r, None)),
40 } 36 }
41 } 37 }
42 38
@@ -204,7 +200,7 @@ fn macro_expand_with_arg(
204 Some(it) => it, 200 Some(it) => it,
205 None => return (None, Some("Fail to find macro definition".into())), 201 None => return (None, Some("Fail to find macro definition".into())),
206 }; 202 };
207 let (tt, err) = macro_rules.0.expand(db, lazy_id, &macro_arg.0); 203 let ExpandResult(tt, err) = macro_rules.0.expand(db, lazy_id, &macro_arg.0);
208 // Set a hard limit for the expanded tt 204 // Set a hard limit for the expanded tt
209 let count = tt.count(); 205 let count = tt.count();
210 if count > 65536 { 206 if count > 65536 {