From d29c52354c9ee5715426bd66c45464f06dd1afd5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Mon, 16 Aug 2021 14:27:36 +0300 Subject: [PATCH] minor: remove dead code --- crates/hir_expand/src/db.rs | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-) diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index a9bf6db476..d619d6a462 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -336,35 +336,17 @@ fn macro_def(db: &dyn AstDatabase, id: MacroDefId) -> Option> } fn macro_expand(db: &dyn AstDatabase, id: MacroCallId) -> ExpandResult>> { - macro_expand_with_arg(db, id, None) -} - -fn macro_expand_error(db: &dyn AstDatabase, macro_call: MacroCallId) -> Option { - db.macro_expand(macro_call).err -} - -fn macro_expand_with_arg( - db: &dyn AstDatabase, - id: MacroCallId, - arg: Option>, -) -> ExpandResult>> { let _p = profile::span("macro_expand"); let loc: MacroCallLoc = db.lookup_intern_macro(id); if let Some(eager) = &loc.eager { - if arg.is_some() { - return ExpandResult::str_err( - "speculative macro expansion not implemented for eager macro".to_owned(), - ); - } else { - return ExpandResult { - value: Some(eager.arg_or_expansion.clone()), - // FIXME: There could be errors here! - err: None, - }; - } + return ExpandResult { + value: Some(eager.arg_or_expansion.clone()), + // FIXME: There could be errors here! + err: None, + }; } - let macro_arg = match arg.or_else(|| db.macro_arg(id)) { + let macro_arg = match db.macro_arg(id) { Some(it) => it, None => return ExpandResult::str_err("Fail to args in to tt::TokenTree".into()), }; @@ -388,6 +370,10 @@ fn macro_expand_with_arg( ExpandResult { value: Some(Arc::new(tt)), err } } +fn macro_expand_error(db: &dyn AstDatabase, macro_call: MacroCallId) -> Option { + db.macro_expand(macro_call).err +} + fn expand_proc_macro( db: &dyn AstDatabase, id: MacroCallId,