diff options
Diffstat (limited to 'crates/ra_assists/src/handlers')
-rw-r--r-- | crates/ra_assists/src/handlers/add_impl.rs | 4 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/add_new.rs | 5 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/introduce_variable.rs | 2 | ||||
-rw-r--r-- | crates/ra_assists/src/handlers/merge_imports.rs | 4 |
4 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_assists/src/handlers/add_impl.rs b/crates/ra_assists/src/handlers/add_impl.rs index 6622eadb2..72a201b6d 100644 --- a/crates/ra_assists/src/handlers/add_impl.rs +++ b/crates/ra_assists/src/handlers/add_impl.rs | |||
@@ -1,5 +1,5 @@ | |||
1 | use ra_syntax::{ | 1 | use ra_syntax::{ |
2 | ast::{self, AstNode, NameOwner, TypeParamsOwner}, | 2 | ast::{self, AstNode, AstToken, NameOwner, TypeParamsOwner}, |
3 | TextUnit, | 3 | TextUnit, |
4 | }; | 4 | }; |
5 | use stdx::{format_to, SepBy}; | 5 | use stdx::{format_to, SepBy}; |
@@ -42,7 +42,7 @@ pub(crate) fn add_impl(ctx: AssistCtx) -> Option<Assist> { | |||
42 | if let Some(type_params) = type_params { | 42 | if let Some(type_params) = type_params { |
43 | let lifetime_params = type_params | 43 | let lifetime_params = type_params |
44 | .lifetime_params() | 44 | .lifetime_params() |
45 | .filter_map(|it| it.lifetime_token()) | 45 | .filter_map(|it| it.lifetime()) |
46 | .map(|it| it.text().clone()); | 46 | .map(|it| it.text().clone()); |
47 | let type_params = | 47 | let type_params = |
48 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); | 48 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); |
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs index 240b19fa3..c10397249 100644 --- a/crates/ra_assists/src/handlers/add_new.rs +++ b/crates/ra_assists/src/handlers/add_new.rs | |||
@@ -1,7 +1,8 @@ | |||
1 | use hir::Adt; | 1 | use hir::Adt; |
2 | use ra_syntax::{ | 2 | use ra_syntax::{ |
3 | ast::{ | 3 | ast::{ |
4 | self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner, | 4 | self, AstNode, AstToken, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, |
5 | VisibilityOwner, | ||
5 | }, | 6 | }, |
6 | TextUnit, T, | 7 | TextUnit, T, |
7 | }; | 8 | }; |
@@ -105,7 +106,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String { | |||
105 | if let Some(type_params) = type_params { | 106 | if let Some(type_params) = type_params { |
106 | let lifetime_params = type_params | 107 | let lifetime_params = type_params |
107 | .lifetime_params() | 108 | .lifetime_params() |
108 | .filter_map(|it| it.lifetime_token()) | 109 | .filter_map(|it| it.lifetime()) |
109 | .map(|it| it.text().clone()); | 110 | .map(|it| it.text().clone()); |
110 | let type_params = | 111 | let type_params = |
111 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); | 112 | type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); |
diff --git a/crates/ra_assists/src/handlers/introduce_variable.rs b/crates/ra_assists/src/handlers/introduce_variable.rs index 1edbdc14c..8a02f1a32 100644 --- a/crates/ra_assists/src/handlers/introduce_variable.rs +++ b/crates/ra_assists/src/handlers/introduce_variable.rs | |||
@@ -124,7 +124,7 @@ fn anchor_stmt(expr: ast::Expr) -> Option<(SyntaxNode, bool)> { | |||
124 | } | 124 | } |
125 | } | 125 | } |
126 | 126 | ||
127 | if ast::Stmt::cast(node.clone()).is_some() { | 127 | if ast::Stmt::cast(node.clone().into()).is_some() { |
128 | return Some((node, false)); | 128 | return Some((node, false)); |
129 | } | 129 | } |
130 | 130 | ||
diff --git a/crates/ra_assists/src/handlers/merge_imports.rs b/crates/ra_assists/src/handlers/merge_imports.rs index 5d4b74e56..f8b3ddb4e 100644 --- a/crates/ra_assists/src/handlers/merge_imports.rs +++ b/crates/ra_assists/src/handlers/merge_imports.rs | |||
@@ -3,7 +3,7 @@ use std::iter::successors; | |||
3 | use ra_syntax::{ | 3 | use ra_syntax::{ |
4 | algo::{neighbor, SyntaxRewriter}, | 4 | algo::{neighbor, SyntaxRewriter}, |
5 | ast::{self, edit::AstNodeEdit, make}, | 5 | ast::{self, edit::AstNodeEdit, make}, |
6 | AstNode, Direction, InsertPosition, SyntaxElement, T, | 6 | AstNode, AstToken, Direction, InsertPosition, SyntaxElement, T, |
7 | }; | 7 | }; |
8 | 8 | ||
9 | use crate::{Assist, AssistCtx, AssistId}; | 9 | use crate::{Assist, AssistCtx, AssistId}; |
@@ -82,7 +82,7 @@ fn try_merge_trees(old: &ast::UseTree, new: &ast::UseTree) -> Option<ast::UseTre | |||
82 | .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']), | 82 | .filter(|it| it.kind() != T!['{'] && it.kind() != T!['}']), |
83 | ); | 83 | ); |
84 | let use_tree_list = lhs.use_tree_list()?; | 84 | let use_tree_list = lhs.use_tree_list()?; |
85 | let pos = InsertPosition::Before(use_tree_list.r_curly()?.into()); | 85 | let pos = InsertPosition::Before(use_tree_list.r_curly()?.syntax().clone().into()); |
86 | let use_tree_list = use_tree_list.insert_children(pos, to_insert); | 86 | let use_tree_list = use_tree_list.insert_children(pos, to_insert); |
87 | Some(lhs.with_use_tree_list(use_tree_list)) | 87 | Some(lhs.with_use_tree_list(use_tree_list)) |
88 | } | 88 | } |