From c9b4ac5be4daaabc062ab1ee663eba8594750003 Mon Sep 17 00:00:00 2001 From: Maan2003 Date: Sun, 13 Jun 2021 09:24:16 +0530 Subject: clippy::redudant_borrow --- crates/hir_expand/src/builtin_macro.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/hir_expand/src/builtin_macro.rs') diff --git a/crates/hir_expand/src/builtin_macro.rs b/crates/hir_expand/src/builtin_macro.rs index 0b310ba2f..51572226e 100644 --- a/crates/hir_expand/src/builtin_macro.rs +++ b/crates/hir_expand/src/builtin_macro.rs @@ -354,7 +354,7 @@ fn concat_expand( // concat works with string and char literals, so remove any quotes. // It also works with integer, float and boolean literals, so just use the rest // as-is. - let component = unquote_str(&it).unwrap_or_else(|| it.text.to_string()); + let component = unquote_str(it).unwrap_or_else(|| it.text.to_string()); text.push_str(&component); } // handle boolean literals @@ -417,7 +417,7 @@ fn parse_string(tt: &tt::Subtree) -> Result { tt.token_trees .get(0) .and_then(|tt| match tt { - tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(&it), + tt::TokenTree::Leaf(tt::Leaf::Literal(it)) => unquote_str(it), _ => None, }) .ok_or_else(|| mbe::ExpandError::ConversionError) @@ -561,7 +561,7 @@ mod tests { use syntax::ast::NameOwner; fn expand_builtin_macro(ra_fixture: &str) -> String { - let (db, file_id) = TestDB::with_single_file(&ra_fixture); + let (db, file_id) = TestDB::with_single_file(ra_fixture); let parsed = db.parse(file_id); let mut macro_rules: Vec<_> = parsed.syntax_node().descendants().filter_map(ast::MacroRules::cast).collect(); -- cgit v1.2.3 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_macro.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/hir_expand/src/builtin_macro.rs') 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() } }; -- cgit v1.2.3