From 6cc6dee9e96d55dbbd8593523551a9981a691147 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:25:55 +0530 Subject: clippy::useless_conversion --- crates/hir_expand/src/builtin_derive.rs | 2 +- crates/hir_expand/src/builtin_macro.rs | 8 ++++---- crates/hir_expand/src/db.rs | 2 +- crates/hir_expand/src/eager.rs | 8 +++----- 4 files changed, 9 insertions(+), 11 deletions(-) (limited to 'crates/hir_expand/src') diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs index fe9497b50..4610f6f91 100644 --- a/crates/hir_expand/src/builtin_derive.rs +++ b/crates/hir_expand/src/builtin_derive.rs @@ -325,7 +325,7 @@ $0 }, }; - let id: MacroCallId = db.intern_macro(loc).into(); + let id: MacroCallId = db.intern_macro(loc); let parsed = db.parse_or_expand(id.as_file()).unwrap(); // FIXME text() for syntax nodes parsed from token tree looks weird diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 51572226e..f24d1d919 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs @@ -430,7 +430,7 @@ fn include_expand( ) -> ExpandResult> { let res = (|| { let path = parse_string(tt)?; - let file_id = relative_file(db, arg_id.into(), &path, false)?; + 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)? @@ -480,7 +480,7 @@ fn include_str_expand( // it's unusual to `include_str!` a Rust file), but we can return an empty string. // Ideally, we'd be able to offer a precise expansion if the user asks for macro // expansion. - let file_id = match relative_file(db, arg_id.into(), &path, true) { + let file_id = match relative_file(db, arg_id, &path, true) { Ok(file_id) => file_id, Err(_) => { return ExpandResult::ok(Some(ExpandedEager::new(quote!("")))); @@ -598,7 +598,7 @@ mod tests { }, }; - let id: MacroCallId = db.intern_macro(loc).into(); + let id: MacroCallId = db.intern_macro(loc); id.as_file() } Either::Right(expander) => { @@ -635,7 +635,7 @@ mod tests { kind: MacroCallKind::FnLike { ast_id: call_id, fragment }, }; - let id: MacroCallId = db.intern_macro(loc).into(); + let id: MacroCallId = db.intern_macro(loc); id.as_file() } }; diff --git a/crates/hir_expand/src/db.rs b/crates/hir_expand/src/db.rs index 45e6e446a..4aecf4af5 100644 --- a/crates/hir_expand/src/db.rs +++ b/crates/hir_expand/src/db.rs @@ -57,7 +57,7 @@ impl TokenExpander { // We store the result in salsa db to prevent non-deterministic behavior in // some proc-macro implementation // See #4315 for details - db.expand_proc_macro(id.into()).into() + db.expand_proc_macro(id).into() } } } diff --git a/crates/hir_expand/src/eager.rs b/crates/hir_expand/src/eager.rs index 9093255f4..07799ed2f 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.into(); + let arg_file_id: MacroCallId = arg_id; let parsed_args = diagnostic_sink.result(mbe::token_tree_to_syntax_node(&parsed_args, FragmentKind::Expr))?.0; @@ -182,8 +182,7 @@ fn lazy_expand( db, krate, MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, - ) - .into(); + ); let err = db.macro_expand_error(id); let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node)); @@ -216,8 +215,7 @@ fn eager_macro_recur( def, macro_resolver, diagnostic_sink, - )? - .into(); + )?; db.parse_or_expand(id.as_file()) .expect("successful macro expansion should be parseable") .clone_for_update() -- cgit v1.2.3