aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_expand
diff options
context:
space:
mode:
authorMaan2003 <[email protected]>2021-06-13 04:55:55 +0100
committerMaan2003 <[email protected]>2021-06-13 04:55:55 +0100
commit6cc6dee9e96d55dbbd8593523551a9981a691147 (patch)
treec9a790918f586acd877908a5b34e6b073d551b49 /crates/hir_expand
parentc9b4ac5be4daaabc062ab1ee663eba8594750003 (diff)
clippy::useless_conversion
Diffstat (limited to 'crates/hir_expand')
-rw-r--r--crates/hir_expand/src/builtin_derive.rs2
-rw-r--r--crates/hir_expand/src/builtin_macro.rs8
-rw-r--r--crates/hir_expand/src/db.rs2
-rw-r--r--crates/hir_expand/src/eager.rs8
4 files changed, 9 insertions, 11 deletions
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
325 }, 325 },
326 }; 326 };
327 327
328 let id: MacroCallId = db.intern_macro(loc).into(); 328 let id: MacroCallId = db.intern_macro(loc);
329 let parsed = db.parse_or_expand(id.as_file()).unwrap(); 329 let parsed = db.parse_or_expand(id.as_file()).unwrap();
330 330
331 // FIXME text() for syntax nodes parsed from token tree looks weird 331 // 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(
430) -> ExpandResult<Option<ExpandedEager>> { 430) -> ExpandResult<Option<ExpandedEager>> {
431 let res = (|| { 431 let res = (|| {
432 let path = parse_string(tt)?; 432 let path = parse_string(tt)?;
433 let file_id = relative_file(db, arg_id.into(), &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 = parse_to_token_tree(&db.file_text(file_id))
436 .ok_or_else(|| mbe::ExpandError::ConversionError)? 436 .ok_or_else(|| mbe::ExpandError::ConversionError)?
@@ -480,7 +480,7 @@ fn include_str_expand(
480 // it's unusual to `include_str!` a Rust file), but we can return an empty string. 480 // it's unusual to `include_str!` a Rust file), but we can return an empty string.
481 // Ideally, we'd be able to offer a precise expansion if the user asks for macro 481 // Ideally, we'd be able to offer a precise expansion if the user asks for macro
482 // expansion. 482 // expansion.
483 let file_id = match relative_file(db, arg_id.into(), &path, true) { 483 let file_id = match relative_file(db, arg_id, &path, true) {
484 Ok(file_id) => file_id, 484 Ok(file_id) => file_id,
485 Err(_) => { 485 Err(_) => {
486 return ExpandResult::ok(Some(ExpandedEager::new(quote!("")))); 486 return ExpandResult::ok(Some(ExpandedEager::new(quote!(""))));
@@ -598,7 +598,7 @@ mod tests {
598 }, 598 },
599 }; 599 };
600 600
601 let id: MacroCallId = db.intern_macro(loc).into(); 601 let id: MacroCallId = db.intern_macro(loc);
602 id.as_file() 602 id.as_file()
603 } 603 }
604 Either::Right(expander) => { 604 Either::Right(expander) => {
@@ -635,7 +635,7 @@ mod tests {
635 kind: MacroCallKind::FnLike { ast_id: call_id, fragment }, 635 kind: MacroCallKind::FnLike { ast_id: call_id, fragment },
636 }; 636 };
637 637
638 let id: MacroCallId = db.intern_macro(loc).into(); 638 let id: MacroCallId = db.intern_macro(loc);
639 id.as_file() 639 id.as_file()
640 } 640 }
641 }; 641 };
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 {
57 // We store the result in salsa db to prevent non-deterministic behavior in 57 // We store the result in salsa db to prevent non-deterministic behavior in
58 // some proc-macro implementation 58 // some proc-macro implementation
59 // See #4315 for details 59 // See #4315 for details
60 db.expand_proc_macro(id.into()).into() 60 db.expand_proc_macro(id).into()
61 } 61 }
62 } 62 }
63 } 63 }
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(
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.into(); 131 let arg_file_id: MacroCallId = 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;
@@ -182,8 +182,7 @@ fn lazy_expand(
182 db, 182 db,
183 krate, 183 krate,
184 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment }, 184 MacroCallKind::FnLike { ast_id: macro_call.with_value(ast_id), fragment },
185 ) 185 );
186 .into();
187 186
188 let err = db.macro_expand_error(id); 187 let err = db.macro_expand_error(id);
189 let value = db.parse_or_expand(id.as_file()).map(|node| InFile::new(id.as_file(), node)); 188 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(
216 def, 215 def,
217 macro_resolver, 216 macro_resolver,
218 diagnostic_sink, 217 diagnostic_sink,
219 )? 218 )?;
220 .into();
221 db.parse_or_expand(id.as_file()) 219 db.parse_or_expand(id.as_file())
222 .expect("successful macro expansion should be parseable") 220 .expect("successful macro expansion should be parseable")
223 .clone_for_update() 221 .clone_for_update()