From 47747cd4120e260a144242aadd7732e11d133fe4 Mon Sep 17 00:00:00 2001 From: Clemens Wasser Date: Mon, 7 Jun 2021 13:59:01 +0200 Subject: Apply some clippy suggestions --- crates/hir_expand/src/builtin_macro.rs | 7 +++---- crates/hir_expand/src/eager.rs | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/hir_expand/src') 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 { tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it), _ => None, }) - .ok_or_else(|| mbe::ExpandError::ConversionError) + .ok_or(mbe::ExpandError::ConversionError) } fn include_expand( @@ -432,9 +432,8 @@ fn include_expand( let path = parse_string(tt)?; let file_id = relative_file(db, arg_id, &path, false)?; - let subtree = parse_to_token_tree(&db.file_text(file_id)) - .ok_or_else(|| mbe::ExpandError::ConversionError)? - .0; + let subtree = + parse_to_token_tree(&db.file_text(file_id)).ok_or(mbe::ExpandError::ConversionError)?.0; Ok((subtree, file_id)) })(); 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( }), kind: MacroCallKind::FnLike { ast_id: call_id, fragment: FragmentKind::Expr }, }); - let arg_file_id: MacroCallId = arg_id; + let arg_file_id = arg_id; let parsed_args = diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0; @@ -177,7 +177,7 @@ fn lazy_expand( let ast_id = db.ast_id_map(macro_call.file_id).ast_id(¯o_call.value); let fragment = crate::to_fragment_kind(¯o_call.value); - let id: MacroCallId = def.as_lazy_macro( + let id = def.as_lazy_macro( db, krate, MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, @@ -207,7 +207,7 @@ fn eager_macro_recur( .option_with(|| macro_resolver(child.path()?), || err("failed to resolve macro"))?; let insert = match def.kind { MacroDefKind::BuiltInEager(..) => { - let id: MacroCallId = expand_eager_macro( + let id = expand_eager_macro( db, krate, curr.with_value(child.clone()), -- cgit v1.2.3