aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-04-09 17:54:14 +0100
committerGitHub <[email protected]>2020-04-09 17:54:14 +0100
commitdde9488559514e7d039cec9407e1f8627f665cd0 (patch)
tree5ddc0361d4d3538b60cb63a645042cfdcd51f4c6 /crates/ra_ide/src
parent4cea01fdf8dc0a647007bde3010f9fbe607f1e75 (diff)
parent2bfb65db93e48d8f9e8ecac0b2ea837c081a4db5 (diff)
Merge #3919
3919: Refactor tokena accessors r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_ide/src')
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs5
-rw-r--r--crates/ra_ide/src/references.rs2
-rw-r--r--crates/ra_ide/src/typing.rs2
3 files changed, 6 insertions, 3 deletions
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> {
190 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) { 190 if let Some(name) = find_node_at_offset::<ast::Name>(&file_with_fake_ident, offset) {
191 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) { 191 if let Some(bind_pat) = name.syntax().ancestors().find_map(ast::BindPat::cast) {
192 self.is_pat_binding_or_const = true; 192 self.is_pat_binding_or_const = true;
193 if bind_pat.has_at() || bind_pat.is_ref() || bind_pat.is_mutable() { 193 if bind_pat.at_token().is_some()
194 || bind_pat.ref_kw_token().is_some()
195 || bind_pat.mut_kw_token().is_some()
196 {
194 self.is_pat_binding_or_const = false; 197 self.is_pat_binding_or_const = false;
195 } 198 }
196 if bind_pat.syntax().parent().and_then(ast::RecordFieldPatList::cast).is_some() { 199 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
152 if stmt.initializer().is_some() { 152 if stmt.initializer().is_some() {
153 let pat = stmt.pat()?; 153 let pat = stmt.pat()?;
154 if let ast::Pat::BindPat(it) = pat { 154 if let ast::Pat::BindPat(it) = pat {
155 if it.is_mutable() { 155 if it.mut_kw_token().is_some() {
156 return Some(ReferenceAccess::Write); 156 return Some(ReferenceAccess::Write);
157 } 157 }
158 } 158 }
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(
63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> { 63fn on_eq_typed(file: &SourceFile, offset: TextUnit) -> Option<SingleFileChange> {
64 assert_eq!(file.syntax().text().char_at(offset), Some('=')); 64 assert_eq!(file.syntax().text().char_at(offset), Some('='));
65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?; 65 let let_stmt: ast::LetStmt = find_node_at_offset(file.syntax(), offset)?;
66 if let_stmt.has_semi() { 66 if let_stmt.semi_token().is_some() {
67 return None; 67 return None;
68 } 68 }
69 if let Some(expr) = let_stmt.initializer() { 69 if let Some(expr) = let_stmt.initializer() {