From 2bfb65db93e48d8f9e8ecac0b2ea837c081a4db5 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 9 Apr 2020 18:40:43 +0200 Subject: Be consistent about token accesors --- crates/ra_ide/src/completion/completion_context.rs | 5 ++++- crates/ra_ide/src/references.rs | 2 +- crates/ra_ide/src/typing.rs | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide/src') diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs index f833d2a9a..0e34d85db 100644 --- a/crates/ra_ide/src/completion/completion_context.rs +++ b/crates/ra_ide/src/completion/completion_context.rs @@ -190,7 +190,10 @@ impl<'a> CompletionContext<'a> { if let Some(name) = find_node_at_offset::(&file_with_fake_ident, offset) { if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { self.is_pat_binding_or_const = true; - if bind_pat.has_at() || bind_pat.is_ref() || bind_pat.is_mutable() { + if bind_pat.at_token().is_some() + || bind_pat.ref_kw_token().is_some() + || bind_pat.mut_kw_token().is_some() + { self.is_pat_binding_or_const = false; } if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { diff --git a/crates/ra_ide/src/references.rs b/crates/ra_ide/src/references.rs index 746cc86ba..ad6fd50aa 100644 --- a/crates/ra_ide/src/references.rs +++ b/crates/ra_ide/src/references.rs @@ -152,7 +152,7 @@ fn decl_access(def: &Definition, syntax: &SyntaxNode, range: TextRange) -> Optio if stmt.initializer().is_some() { let pat = stmt.pat()?; if let ast::Pat::BindPat(it) = pat { - if it.is_mutable() { + if it.mut_kw_token().is_some() { return Some(ReferenceAccess::Write); } } diff --git a/crates/ra_ide/src/typing.rs b/crates/ra_ide/src/typing.rs index cb2cd2479..71d2bcb04 100644 --- a/crates/ra_ide/src/typing.rs +++ b/crates/ra_ide/src/typing.rs @@ -63,7 +63,7 @@ fn on_char_typed_inner( fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option { assert_eq!(file.syntax().text().char_at(offset), Some('=')); let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; - if let_stmt.has_semi() { + if let_stmt.semi_token().is_some() { return None; } if let Some(expr) = let_stmt.initializer() { -- cgit v1.2.3