aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_expand/src')
-rw-r--r--crates/hir_expand/src/builtin_macro.rs7
-rw-r--r--crates/hir_expand/src/eager.rs6
2 files changed, 6 insertions, 7 deletions
diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs
index 4c83a2efe..f556bc751 100644
--- a/crates/hir_expand/src/builtin_macro.rs
+++ b/crates/hir_expand/src/builtin_macro.rs
@@ -420,7 +420,7 @@ fn parse_string(tt: &tt::Subtree) -> Result<String, mbe::ExpandError> {
420 tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it), 420 tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it),
421 _ => None, 421 _ => None,
422 }) 422 })
423 .ok_or_else(|| mbe::ExpandError::ConversionError) 423 .ok_or(mbe::ExpandError::ConversionError)
424} 424}
425 425
426fn include_expand( 426fn include_expand(
@@ -432,9 +432,8 @@ fn include_expand(
432 let path = parse_string(tt)?; 432 let path = parse_string(tt)?;
433 let file_id = relative_file(db, arg_id, &path, false)?; 433 let file_id = relative_file(db, arg_id, &path, false)?;
434 434
435 let subtree = parse_to_token_tree(&db.file_text(file_id)) 435 let subtree =
436 .ok_or_else(|| mbe::ExpandError::ConversionError)? 436 parse_to_token_tree(&db.file_text(file_id)).ok_or(mbe::ExpandError::ConversionError)?.0;
437 .0;
438 Ok((subtree, file_id)) 437 Ok((subtree, file_id))
439 })(); 438 })();
440 439
diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs
index 584ddcf9f..66601f4df 100644
--- a/crates/hir_expand/src/eager.rs
+++ b/crates/hir_expand/src/eager.rs
@@ -128,7 +128,7 @@ pub fn expand_eager_macro(
128 }), 128 }),
129 kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr }, 129 kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr },
130 }); 130 });
131 let arg_file_id: MacroCallId = arg_id; 131 let arg_file_id = arg_id;
132 132
133 let parsed_args = 133 let parsed_args =
134 diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0; 134 diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0;
@@ -177,7 +177,7 @@ fn lazy_expand(
177 let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value); 177 let ast_id = db.ast_id_map(macro_call.file_id).ast_id(&macro_call.value);
178 178
179 let fragment = crate::to_fragment_kind(&macro_call.value); 179 let fragment = crate::to_fragment_kind(&macro_call.value);
180 let id: MacroCallId = def.as_lazy_macro( 180 let id = def.as_lazy_macro(
181 db, 181 db,
182 krate, 182 krate,
183 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, 183 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
@@ -207,7 +207,7 @@ fn eager_macro_recur(
207 .option_with(|| macro_resolver(child.path()?), || err("failed to resolve macro"))?; 207 .option_with(|| macro_resolver(child.path()?), || err("failed to resolve macro"))?;
208 let insert = match def.kind { 208 let insert = match def.kind {
209 MacroDefKind::BuiltInEager(..) => { 209 MacroDefKind::BuiltInEager(..) => {
210 let id: MacroCallId = expand_eager_macro( 210 let id = expand_eager_macro(
211 db, 211 db,
212 krate, 212 krate,
213 curr.with_value(child.clone()), 213 curr.with_value(child.clone()),