diff options
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r-- | crates/ra_ide/src/completion/completion_context.rs | 10 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/patterns.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/display/short_label.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/extend_selection.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/file_structure.rs | 6 | ||||
-rw-r--r-- | crates/ra_ide/src/folding_ranges.rs | 2 | ||||
-rw-r--r-- | crates/ra_ide/src/inlay_hints.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/references.rs | 14 | ||||
-rw-r--r-- | crates/ra_ide/src/references/rename.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/syntax_highlighting.rs | 6 |
11 files changed, 38 insertions, 34 deletions
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index 2113abbb2..6b03b30bb 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs | |||
@@ -265,7 +265,7 @@ impl<'a> CompletionContext<'a> { | |||
265 | return; | 265 | return; |
266 | } | 266 | } |
267 | // FIXME: remove this (V) duplication and make the check more precise | 267 | // FIXME: remove this (V) duplication and make the check more precise |
268 | if name_ref.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { | 268 | if name_ref.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() { |
269 | self.record_pat_syntax = | 269 | self.record_pat_syntax = |
270 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 270 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
271 | } | 271 | } |
@@ -275,7 +275,7 @@ impl<'a> CompletionContext<'a> { | |||
275 | // Otherwise, see if this is a declaration. We can use heuristics to | 275 | // Otherwise, see if this is a declaration. We can use heuristics to |
276 | // suggest declaration names, see `CompletionKind::Magic`. | 276 | // suggest declaration names, see `CompletionKind::Magic`. |
277 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { | 277 | if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { |
278 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { | 278 | if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::IdentPat::cast) { |
279 | self.is_pat_binding_or_const = true; | 279 | self.is_pat_binding_or_const = true; |
280 | if bind_pat.at_token().is_some() | 280 | if bind_pat.at_token().is_some() |
281 | || bind_pat.ref_token().is_some() | 281 | || bind_pat.ref_token().is_some() |
@@ -283,7 +283,7 @@ impl<'a> CompletionContext<'a> { | |||
283 | { | 283 | { |
284 | self.is_pat_binding_or_const = false; | 284 | self.is_pat_binding_or_const = false; |
285 | } | 285 | } |
286 | if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { | 286 | if bind_pat.syntax().parent().and_then(ast::RecordPatFieldList::cast).is_some() { |
287 | self.is_pat_binding_or_const = false; | 287 | self.is_pat_binding_or_const = false; |
288 | } | 288 | } |
289 | if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { | 289 | if let Some(let_stmt) = bind_pat.syntax().ancestors().find_map(ast::LetStmt::cast) { |
@@ -300,7 +300,7 @@ impl<'a> CompletionContext<'a> { | |||
300 | return; | 300 | return; |
301 | } | 301 | } |
302 | // FIXME: remove this (^) duplication and make the check more precise | 302 | // FIXME: remove this (^) duplication and make the check more precise |
303 | if name.syntax().ancestors().find_map(ast::RecordFieldPatList::cast).is_some() { | 303 | if name.syntax().ancestors().find_map(ast::RecordPatFieldList::cast).is_some() { |
304 | self.record_pat_syntax = | 304 | self.record_pat_syntax = |
305 | self.sema.find_node_at_offset_with_macros(&original_file, offset); | 305 | self.sema.find_node_at_offset_with_macros(&original_file, offset); |
306 | } | 306 | } |
@@ -377,7 +377,7 @@ impl<'a> CompletionContext<'a> { | |||
377 | path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some(); | 377 | path.syntax().parent().and_then(ast::TupleStructPat::cast).is_some(); |
378 | 378 | ||
379 | self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); | 379 | self.is_path_type = path.syntax().parent().and_then(ast::PathType::cast).is_some(); |
380 | self.has_type_args = segment.type_arg_list().is_some(); | 380 | self.has_type_args = segment.generic_arg_list().is_some(); |
381 | 381 | ||
382 | #[allow(deprecated)] | 382 | #[allow(deprecated)] |
383 | if let Some(path) = hir::Path::from_ast(path.clone()) { | 383 | if let Some(path) = hir::Path::from_ast(path.clone()) { |
diff --git a/crates/ra_ide/src/completion/patterns.rs b/crates/ra_ide/src/completion/patterns.rs index a68861e1c..7c4feff6d 100644 --- a/crates/ra_ide/src/completion/patterns.rs +++ b/crates/ra_ide/src/completion/patterns.rs | |||
@@ -44,7 +44,7 @@ fn test_has_block_expr_parent() { | |||
44 | } | 44 | } |
45 | 45 | ||
46 | pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { | 46 | pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { |
47 | element.ancestors().find(|it| it.kind() == BIND_PAT).is_some() | 47 | element.ancestors().find(|it| it.kind() == IDENT_PAT).is_some() |
48 | } | 48 | } |
49 | #[test] | 49 | #[test] |
50 | fn test_has_bind_pat_parent() { | 50 | fn test_has_bind_pat_parent() { |
@@ -134,7 +134,7 @@ pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { | |||
134 | NodeOrToken::Token(token) => token.parent(), | 134 | NodeOrToken::Token(token) => token.parent(), |
135 | }; | 135 | }; |
136 | for node in leaf.ancestors() { | 136 | for node in leaf.ancestors() { |
137 | if node.kind() == FN || node.kind() == LAMBDA_EXPR { | 137 | if node.kind() == FN || node.kind() == CLOSURE_EXPR { |
138 | break; | 138 | break; |
139 | } | 139 | } |
140 | let loop_body = match_ast! { | 140 | let loop_body = match_ast! { |
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 45fbc86ef..fdbf75abd 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -7,7 +7,7 @@ use ra_ide_db::{defs::Definition, RootDatabase}; | |||
7 | use ra_syntax::{ | 7 | use ra_syntax::{ |
8 | ast::{self, DocCommentsOwner, NameOwner}, | 8 | ast::{self, DocCommentsOwner, NameOwner}, |
9 | match_ast, AstNode, SmolStr, | 9 | match_ast, AstNode, SmolStr, |
10 | SyntaxKind::{self, BIND_PAT, TYPE_PARAM}, | 10 | SyntaxKind::{self, IDENT_PAT, TYPE_PARAM}, |
11 | TextRange, | 11 | TextRange, |
12 | }; | 12 | }; |
13 | 13 | ||
@@ -253,7 +253,7 @@ impl ToNav for hir::ImplDef { | |||
253 | let focus_range = if derive_attr.is_some() { | 253 | let focus_range = if derive_attr.is_some() { |
254 | None | 254 | None |
255 | } else { | 255 | } else { |
256 | src.value.target_type().map(|ty| original_range(db, src.with_value(ty.syntax())).range) | 256 | src.value.self_ty().map(|ty| original_range(db, src.with_value(ty.syntax())).range) |
257 | }; | 257 | }; |
258 | 258 | ||
259 | NavigationTarget::from_syntax( | 259 | NavigationTarget::from_syntax( |
@@ -339,7 +339,7 @@ impl ToNav for hir::Local { | |||
339 | NavigationTarget { | 339 | NavigationTarget { |
340 | file_id: full_range.file_id, | 340 | file_id: full_range.file_id, |
341 | name, | 341 | name, |
342 | kind: BIND_PAT, | 342 | kind: IDENT_PAT, |
343 | full_range: full_range.range, | 343 | full_range: full_range.range, |
344 | focus_range: None, | 344 | focus_range: None, |
345 | container_name: None, | 345 | container_name: None, |
diff --git a/crates/ra_ide/src/display/short_label.rs b/crates/ra_ide/src/display/short_label.rs index bddf1bd47..0fdf8e9a5 100644 --- a/crates/ra_ide/src/display/short_label.rs +++ b/crates/ra_ide/src/display/short_label.rs | |||
@@ -77,7 +77,7 @@ impl ShortLabel for ast::Variant { | |||
77 | } | 77 | } |
78 | } | 78 | } |
79 | 79 | ||
80 | fn short_label_from_ty<T>(node: &T, ty: Option<ast::TypeRef>, prefix: &str) -> Option<String> | 80 | fn short_label_from_ty<T>(node: &T, ty: Option<ast::Type>, prefix: &str) -> Option<String> |
81 | where | 81 | where |
82 | T: NameOwner + VisibilityOwner, | 82 | T: NameOwner + VisibilityOwner, |
83 | { | 83 | { |
diff --git a/crates/ra_ide/src/extend_selection.rs b/crates/ra_ide/src/extend_selection.rs index fc81b48cc..7230a0ff9 100644 --- a/crates/ra_ide/src/extend_selection.rs +++ b/crates/ra_ide/src/extend_selection.rs | |||
@@ -37,7 +37,7 @@ fn try_extend_selection( | |||
37 | 37 | ||
38 | let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; | 38 | let string_kinds = [COMMENT, STRING, RAW_STRING, BYTE_STRING, RAW_BYTE_STRING]; |
39 | let list_kinds = [ | 39 | let list_kinds = [ |
40 | RECORD_FIELD_PAT_LIST, | 40 | RECORD_PAT_FIELD_LIST, |
41 | MATCH_ARM_LIST, | 41 | MATCH_ARM_LIST, |
42 | RECORD_FIELD_LIST, | 42 | RECORD_FIELD_LIST, |
43 | TUPLE_FIELD_LIST, | 43 | TUPLE_FIELD_LIST, |
@@ -45,7 +45,7 @@ fn try_extend_selection( | |||
45 | VARIANT_LIST, | 45 | VARIANT_LIST, |
46 | USE_TREE_LIST, | 46 | USE_TREE_LIST, |
47 | GENERIC_PARAM_LIST, | 47 | GENERIC_PARAM_LIST, |
48 | TYPE_ARG_LIST, | 48 | GENERIC_ARG_LIST, |
49 | TYPE_BOUND_LIST, | 49 | TYPE_BOUND_LIST, |
50 | PARAM_LIST, | 50 | PARAM_LIST, |
51 | ARG_LIST, | 51 | ARG_LIST, |
diff --git a/crates/ra_ide/src/file_structure.rs b/crates/ra_ide/src/file_structure.rs index 91765140a..87cab4503 100644 --- a/crates/ra_ide/src/file_structure.rs +++ b/crates/ra_ide/src/file_structure.rs | |||
@@ -57,7 +57,7 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
57 | 57 | ||
58 | fn decl_with_type_ref<N: NameOwner + AttrsOwner>( | 58 | fn decl_with_type_ref<N: NameOwner + AttrsOwner>( |
59 | node: &N, | 59 | node: &N, |
60 | type_ref: Option<ast::TypeRef>, | 60 | type_ref: Option<ast::Type>, |
61 | ) -> Option<StructureNode> { | 61 | ) -> Option<StructureNode> { |
62 | let detail = type_ref.map(|type_ref| { | 62 | let detail = type_ref.map(|type_ref| { |
63 | let mut detail = String::new(); | 63 | let mut detail = String::new(); |
@@ -130,8 +130,8 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> { | |||
130 | ast::Const(it) => decl_with_type_ref(&it, it.ty()), | 130 | ast::Const(it) => decl_with_type_ref(&it, it.ty()), |
131 | ast::Static(it) => decl_with_type_ref(&it, it.ty()), | 131 | ast::Static(it) => decl_with_type_ref(&it, it.ty()), |
132 | ast::Impl(it) => { | 132 | ast::Impl(it) => { |
133 | let target_type = it.target_type()?; | 133 | let target_type = it.self_ty()?; |
134 | let target_trait = it.target_trait(); | 134 | let target_trait = it.trait_(); |
135 | let label = match target_trait { | 135 | let label = match target_trait { |
136 | None => format!("impl {}", target_type.syntax().text()), | 136 | None => format!("impl {}", target_type.syntax().text()), |
137 | Some(t) => { | 137 | Some(t) => { |
diff --git a/crates/ra_ide/src/folding_ranges.rs b/crates/ra_ide/src/folding_ranges.rs index 5a6e17936..903c34996 100644 --- a/crates/ra_ide/src/folding_ranges.rs +++ b/crates/ra_ide/src/folding_ranges.rs | |||
@@ -86,7 +86,7 @@ fn fold_kind(kind: SyntaxKind) -> Option<FoldKind> { | |||
86 | USE => Some(FoldKind::Imports), | 86 | USE => Some(FoldKind::Imports), |
87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), | 87 | ARG_LIST | PARAM_LIST => Some(FoldKind::ArgList), |
88 | RECORD_FIELD_LIST | 88 | RECORD_FIELD_LIST |
89 | | RECORD_FIELD_PAT_LIST | 89 | | RECORD_PAT_FIELD_LIST |
90 | | RECORD_EXPR_FIELD_LIST | 90 | | RECORD_EXPR_FIELD_LIST |
91 | | ITEM_LIST | 91 | | ITEM_LIST |
92 | | EXTERN_ITEM_LIST | 92 | | EXTERN_ITEM_LIST |
diff --git a/crates/ra_ide/src/inlay_hints.rs b/crates/ra_ide/src/inlay_hints.rs index 4bbbcd258..1bacead63 100644 --- a/crates/ra_ide/src/inlay_hints.rs +++ b/crates/ra_ide/src/inlay_hints.rs | |||
@@ -78,7 +78,7 @@ pub(crate) fn inlay_hints( | |||
78 | match node { | 78 | match node { |
79 | ast::CallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, | 79 | ast::CallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, |
80 | ast::MethodCallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, | 80 | ast::MethodCallExpr(it) => { get_param_name_hints(&mut res, &sema, config, ast::Expr::from(it)); }, |
81 | ast::BindPat(it) => { get_bind_pat_hints(&mut res, &sema, config, it); }, | 81 | ast::IdentPat(it) => { get_bind_pat_hints(&mut res, &sema, config, it); }, |
82 | _ => (), | 82 | _ => (), |
83 | } | 83 | } |
84 | } | 84 | } |
@@ -161,7 +161,7 @@ fn get_param_name_hints( | |||
161 | Either::Left(self_param) => Some((self_param.to_string(), arg)), | 161 | Either::Left(self_param) => Some((self_param.to_string(), arg)), |
162 | Either::Right(pat) => { | 162 | Either::Right(pat) => { |
163 | let param_name = match pat { | 163 | let param_name = match pat { |
164 | ast::Pat::BindPat(it) => it.name()?.to_string(), | 164 | ast::Pat::IdentPat(it) => it.name()?.to_string(), |
165 | it => it.to_string(), | 165 | it => it.to_string(), |
166 | }; | 166 | }; |
167 | Some((param_name, arg)) | 167 | Some((param_name, arg)) |
@@ -182,7 +182,7 @@ fn get_bind_pat_hints( | |||
182 | acc: &mut Vec<InlayHint>, | 182 | acc: &mut Vec<InlayHint>, |
183 | sema: &Semantics<RootDatabase>, | 183 | sema: &Semantics<RootDatabase>, |
184 | config: &InlayHintsConfig, | 184 | config: &InlayHintsConfig, |
185 | pat: ast::BindPat, | 185 | pat: ast::IdentPat, |
186 | ) -> Option<()> { | 186 | ) -> Option<()> { |
187 | if !config.type_hints { | 187 | if !config.type_hints { |
188 | return None; | 188 | return None; |
@@ -202,7 +202,7 @@ fn get_bind_pat_hints( | |||
202 | Some(()) | 202 | Some(()) |
203 | } | 203 | } |
204 | 204 | ||
205 | fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type) -> bool { | 205 | fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::IdentPat, pat_ty: &Type) -> bool { |
206 | if let Some(Adt::Enum(enum_data)) = pat_ty.as_adt() { | 206 | if let Some(Adt::Enum(enum_data)) = pat_ty.as_adt() { |
207 | let pat_text = bind_pat.to_string(); | 207 | let pat_text = bind_pat.to_string(); |
208 | enum_data | 208 | enum_data |
@@ -215,7 +215,11 @@ fn pat_is_enum_variant(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | fn should_not_display_type_hint(db: &RootDatabase, bind_pat: &ast::BindPat, pat_ty: &Type) -> bool { | 218 | fn should_not_display_type_hint( |
219 | db: &RootDatabase, | ||
220 | bind_pat: &ast::IdentPat, | ||
221 | pat_ty: &Type, | ||
222 | ) -> bool { | ||
219 | if pat_ty.is_unknown() { | 223 | if pat_ty.is_unknown() { |
220 | return true; | 224 | return true; |
221 | } | 225 | } |
diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 519e4bf1a..cf456630a 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs | |||
@@ -150,7 +150,7 @@ fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Optio | |||
150 | let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?; | 150 | let stmt = find_node_at_offset::<ast::LetStmt>(syntax, range.start())?; |
151 | if stmt.initializer().is_some() { | 151 | if stmt.initializer().is_some() { |
152 | let pat = stmt.pat()?; | 152 | let pat = stmt.pat()?; |
153 | if let ast::Pat::BindPat(it) = pat { | 153 | if let ast::Pat::IdentPat(it) = pat { |
154 | if it.mut_token().is_some() { | 154 | if it.mut_token().is_some() { |
155 | return Some(ReferenceAccess::Write); | 155 | return Some(ReferenceAccess::Write); |
156 | } | 156 | } |
@@ -290,7 +290,7 @@ fn main() { | |||
290 | ); | 290 | ); |
291 | check_result( | 291 | check_result( |
292 | refs, | 292 | refs, |
293 | "i BIND_PAT FileId(1) 24..25 Other Write", | 293 | "i IDENT_PAT FileId(1) 24..25 Other Write", |
294 | &[ | 294 | &[ |
295 | "FileId(1) 50..51 Other Write", | 295 | "FileId(1) 50..51 Other Write", |
296 | "FileId(1) 54..55 Other Read", | 296 | "FileId(1) 54..55 Other Read", |
@@ -316,7 +316,7 @@ fn bar() { | |||
316 | ); | 316 | ); |
317 | check_result( | 317 | check_result( |
318 | refs, | 318 | refs, |
319 | "spam BIND_PAT FileId(1) 19..23 Other", | 319 | "spam IDENT_PAT FileId(1) 19..23 Other", |
320 | &["FileId(1) 34..38 Other Read", "FileId(1) 41..45 Other Read"], | 320 | &["FileId(1) 34..38 Other Read", "FileId(1) 41..45 Other Read"], |
321 | ); | 321 | ); |
322 | } | 322 | } |
@@ -330,7 +330,7 @@ fn foo(i : u32) -> u32 { | |||
330 | } | 330 | } |
331 | "#, | 331 | "#, |
332 | ); | 332 | ); |
333 | check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); | 333 | check_result(refs, "i IDENT_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); |
334 | } | 334 | } |
335 | 335 | ||
336 | #[test] | 336 | #[test] |
@@ -342,7 +342,7 @@ fn foo(i<|> : u32) -> u32 { | |||
342 | } | 342 | } |
343 | "#, | 343 | "#, |
344 | ); | 344 | ); |
345 | check_result(refs, "i BIND_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); | 345 | check_result(refs, "i IDENT_PAT FileId(1) 7..8 Other", &["FileId(1) 29..30 Other Read"]); |
346 | } | 346 | } |
347 | 347 | ||
348 | #[test] | 348 | #[test] |
@@ -559,7 +559,7 @@ fn foo() { | |||
559 | ); | 559 | ); |
560 | check_result( | 560 | check_result( |
561 | refs, | 561 | refs, |
562 | "i BIND_PAT FileId(1) 23..24 Other Write", | 562 | "i IDENT_PAT FileId(1) 23..24 Other Write", |
563 | &["FileId(1) 34..35 Other Write", "FileId(1) 38..39 Other Read"], | 563 | &["FileId(1) 34..35 Other Write", "FileId(1) 38..39 Other Read"], |
564 | ); | 564 | ); |
565 | } | 565 | } |
@@ -595,7 +595,7 @@ fn foo() { | |||
595 | } | 595 | } |
596 | "#, | 596 | "#, |
597 | ); | 597 | ); |
598 | check_result(refs, "i BIND_PAT FileId(1) 19..20 Other", &["FileId(1) 26..27 Other Write"]); | 598 | check_result(refs, "i IDENT_PAT FileId(1) 19..20 Other", &["FileId(1) 26..27 Other Write"]); |
599 | } | 599 | } |
600 | 600 | ||
601 | #[test] | 601 | #[test] |
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs index 31654bf79..c8d80fcf7 100644 --- a/crates/ra_ide/src/references/rename.rs +++ b/crates/ra_ide/src/references/rename.rs | |||
@@ -157,7 +157,7 @@ fn rename_to_self( | |||
157 | } | 157 | } |
158 | let first_param = params.params().next()?; | 158 | let first_param = params.params().next()?; |
159 | let mutable = match first_param.ty() { | 159 | let mutable = match first_param.ty() { |
160 | Some(ast::TypeRef::ReferenceType(rt)) => rt.mut_token().is_some(), | 160 | Some(ast::Type::RefType(rt)) => rt.mut_token().is_some(), |
161 | _ => return None, // not renaming other types | 161 | _ => return None, // not renaming other types |
162 | }; | 162 | }; |
163 | 163 | ||
@@ -194,7 +194,7 @@ fn text_edit_from_self_param( | |||
194 | new_name: &str, | 194 | new_name: &str, |
195 | ) -> Option<TextEdit> { | 195 | ) -> Option<TextEdit> { |
196 | fn target_type_name(impl_def: &ast::Impl) -> Option<String> { | 196 | fn target_type_name(impl_def: &ast::Impl) -> Option<String> { |
197 | if let Some(ast::TypeRef::PathType(p)) = impl_def.target_type() { | 197 | if let Some(ast::Type::PathType(p)) = impl_def.self_ty() { |
198 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); | 198 | return Some(p.path()?.segment()?.name_ref()?.text().to_string()); |
199 | } | 199 | } |
200 | None | 200 | None |
diff --git a/crates/ra_ide/src/syntax_highlighting.rs b/crates/ra_ide/src/syntax_highlighting.rs index e3a96f9d5..a32ae0165 100644 --- a/crates/ra_ide/src/syntax_highlighting.rs +++ b/crates/ra_ide/src/syntax_highlighting.rs | |||
@@ -546,7 +546,7 @@ fn highlight_element( | |||
546 | T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { | 546 | T![!] if element.parent().and_then(ast::MacroCall::cast).is_some() => { |
547 | HighlightTag::Macro.into() | 547 | HighlightTag::Macro.into() |
548 | } | 548 | } |
549 | T![*] if element.parent().and_then(ast::PointerType::cast).is_some() => { | 549 | T![*] if element.parent().and_then(ast::PtrType::cast).is_some() => { |
550 | HighlightTag::Keyword.into() | 550 | HighlightTag::Keyword.into() |
551 | } | 551 | } |
552 | T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { | 552 | T![*] if element.parent().and_then(ast::PrefixExpr::cast).is_some() => { |
@@ -577,7 +577,7 @@ fn highlight_element( | |||
577 | _ if element.parent().and_then(ast::RangePat::cast).is_some() => { | 577 | _ if element.parent().and_then(ast::RangePat::cast).is_some() => { |
578 | HighlightTag::Operator.into() | 578 | HighlightTag::Operator.into() |
579 | } | 579 | } |
580 | _ if element.parent().and_then(ast::DotDotPat::cast).is_some() => { | 580 | _ if element.parent().and_then(ast::RestPat::cast).is_some() => { |
581 | HighlightTag::Operator.into() | 581 | HighlightTag::Operator.into() |
582 | } | 582 | } |
583 | _ if element.parent().and_then(ast::Attr::cast).is_some() => { | 583 | _ if element.parent().and_then(ast::Attr::cast).is_some() => { |
@@ -717,7 +717,7 @@ fn highlight_name_by_syntax(name: ast::Name) -> Highlight { | |||
717 | CONST => HighlightTag::Constant, | 717 | CONST => HighlightTag::Constant, |
718 | STATIC => HighlightTag::Static, | 718 | STATIC => HighlightTag::Static, |
719 | VARIANT => HighlightTag::EnumVariant, | 719 | VARIANT => HighlightTag::EnumVariant, |
720 | BIND_PAT => HighlightTag::Local, | 720 | IDENT_PAT => HighlightTag::Local, |
721 | _ => default, | 721 | _ => default, |
722 | }; | 722 | }; |
723 | 723 | ||