diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_def/src/item_tree/pretty.rs | 2 | ||||
-rw-r--r-- | crates/hir_def/src/lib.rs | 9 | ||||
-rw-r--r-- | crates/hir_def/src/test_db.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/builtin_derive.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/builtin_macro.rs | 8 | ||||
-rw-r--r-- | crates/hir_expand/src/db.rs | 2 | ||||
-rw-r--r-- | crates/hir_expand/src/eager.rs | 8 | ||||
-rw-r--r-- | crates/hir_ty/src/builder.rs | 2 |
8 files changed, 15 insertions, 20 deletions
diff --git a/crates/hir_def/src/item_tree/pretty.rs b/crates/hir_def/src/item_tree/pretty.rs index cc9944a22..b1e1b70d0 100644 --- a/crates/hir_def/src/item_tree/pretty.rs +++ b/crates/hir_def/src/item_tree/pretty.rs | |||
@@ -426,7 +426,7 @@ impl<'a> Printer<'a> { | |||
426 | w!(self, " {{"); | 426 | w!(self, " {{"); |
427 | self.indented(|this| { | 427 | self.indented(|this| { |
428 | for item in &**items { | 428 | for item in &**items { |
429 | this.print_mod_item((*item).into()); | 429 | this.print_mod_item(*item); |
430 | } | 430 | } |
431 | }); | 431 | }); |
432 | wln!(self, "}}"); | 432 | wln!(self, "}}"); |
diff --git a/crates/hir_def/src/lib.rs b/crates/hir_def/src/lib.rs index 987485acc..3e7d496d5 100644 --- a/crates/hir_def/src/lib.rs +++ b/crates/hir_def/src/lib.rs | |||
@@ -736,8 +736,7 @@ fn macro_call_as_call_id( | |||
736 | db.upcast(), | 736 | db.upcast(), |
737 | krate, | 737 | krate, |
738 | MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, | 738 | MacroCallKind::FnLike { ast_id: call.ast_id, fragment }, |
739 | ) | 739 | )) |
740 | .into()) | ||
741 | }; | 740 | }; |
742 | Ok(res) | 741 | Ok(res) |
743 | } | 742 | } |
@@ -765,8 +764,7 @@ fn derive_macro_as_call_id( | |||
765 | derive_name: last_segment.to_string(), | 764 | derive_name: last_segment.to_string(), |
766 | derive_attr_index: derive_attr.ast_index, | 765 | derive_attr_index: derive_attr.ast_index, |
767 | }, | 766 | }, |
768 | ) | 767 | ); |
769 | .into(); | ||
770 | Ok(res) | 768 | Ok(res) |
771 | } | 769 | } |
772 | 770 | ||
@@ -804,7 +802,6 @@ fn attr_macro_as_call_id( | |||
804 | attr_args: arg, | 802 | attr_args: arg, |
805 | invoc_attr_index: macro_attr.id.ast_index, | 803 | invoc_attr_index: macro_attr.id.ast_index, |
806 | }, | 804 | }, |
807 | ) | 805 | ); |
808 | .into(); | ||
809 | Ok(res) | 806 | Ok(res) |
810 | } | 807 | } |
diff --git a/crates/hir_def/src/test_db.rs b/crates/hir_def/src/test_db.rs index b20b066e2..a16203fdb 100644 --- a/crates/hir_def/src/test_db.rs +++ b/crates/hir_def/src/test_db.rs | |||
@@ -325,7 +325,7 @@ impl TestDB { | |||
325 | for diag in source_map.diagnostics() { | 325 | for diag in source_map.diagnostics() { |
326 | let (ptr, message): (InFile<SyntaxNodePtr>, &str) = match diag { | 326 | let (ptr, message): (InFile<SyntaxNodePtr>, &str) = match diag { |
327 | BodyDiagnostic::InactiveCode { node, .. } => { | 327 | BodyDiagnostic::InactiveCode { node, .. } => { |
328 | (node.clone().map(|it| it.into()), "InactiveCode") | 328 | (node.clone().map(|it| it), "InactiveCode") |
329 | } | 329 | } |
330 | BodyDiagnostic::MacroError { node, message } => { | 330 | BodyDiagnostic::MacroError { node, message } => { |
331 | (node.clone().map(|it| it.into()), message.as_str()) | 331 | (node.clone().map(|it| it.into()), message.as_str()) |
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() |
diff --git a/crates/hir_ty/src/builder.rs b/crates/hir_ty/src/builder.rs index 893e727c2..bb9d84246 100644 --- a/crates/hir_ty/src/builder.rs +++ b/crates/hir_ty/src/builder.rs | |||
@@ -202,7 +202,7 @@ impl<T: HasInterner<Interner = Interner> + Fold<Interner>> TyBuilder<Binders<T>> | |||
202 | 202 | ||
203 | impl TyBuilder<Binders<Ty>> { | 203 | impl TyBuilder<Binders<Ty>> { |
204 | pub fn def_ty(db: &dyn HirDatabase, def: TyDefId) -> TyBuilder<Binders<Ty>> { | 204 | pub fn def_ty(db: &dyn HirDatabase, def: TyDefId) -> TyBuilder<Binders<Ty>> { |
205 | TyBuilder::subst_binders(db.ty(def.into())) | 205 | TyBuilder::subst_binders(db.ty(def)) |
206 | } | 206 | } |
207 | 207 | ||
208 | pub fn impl_self_ty(db: &dyn HirDatabase, def: hir_def::ImplId) -> TyBuilder<Binders<Ty>> { | 208 | pub fn impl_self_ty(db: &dyn HirDatabase, def: hir_def::ImplId) -> TyBuilder<Binders<Ty>> { |