aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/references
diff options
context:
space:
mode:
authorVeetaha <[email protected]>2020-01-26 18:44:49 +0000
committerVeetaha <[email protected]>2020-02-03 22:00:55 +0000
commitac37a11f04b31f792068a1cb50dbbf5ccd4d982d (patch)
tree52542f3e7b7ec9f4cfbedf2245c4fd4bb8cdffcb /crates/ra_ide/src/references
parentad24976da38482948c586bdbc16004273662ff7e (diff)
Reimplemented lexer with vectors instead of iterators
Diffstat (limited to 'crates/ra_ide/src/references')
-rw-r--r--crates/ra_ide/src/references/rename.rs10
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/ra_ide/src/references/rename.rs b/crates/ra_ide/src/references/rename.rs
index 626efb603..ad3e86f7c 100644
--- a/crates/ra_ide/src/references/rename.rs
+++ b/crates/ra_ide/src/references/rename.rs
@@ -2,7 +2,7 @@
2 2
3use hir::ModuleSource; 3use hir::ModuleSource;
4use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt}; 4use ra_db::{RelativePath, RelativePathBuf, SourceDatabase, SourceDatabaseExt};
5use ra_syntax::{algo::find_node_at_offset, ast, tokenize, AstNode, SyntaxKind, SyntaxNode}; 5use ra_syntax::{algo::find_node_at_offset, ast, single_token, AstNode, SyntaxKind, SyntaxNode};
6use ra_text_edit::TextEdit; 6use ra_text_edit::TextEdit;
7 7
8use crate::{ 8use crate::{
@@ -17,11 +17,9 @@ pub(crate) fn rename(
17 position: FilePosition, 17 position: FilePosition,
18 new_name: &str, 18 new_name: &str,
19) -> Option<RangeInfo<SourceChange>> { 19) -> Option<RangeInfo<SourceChange>> {
20 let tokens = tokenize(new_name); 20 match single_token(new_name)?.token.kind {
21 if tokens.len() != 1 21 SyntaxKind::IDENT | SyntaxKind::UNDERSCORE => (),
22 || (tokens[0].kind != SyntaxKind::IDENT && tokens[0].kind != SyntaxKind::UNDERSCORE) 22 _ => return None,
23 {
24 return None;
25 } 23 }
26 24
27 let parse = db.parse(position.file_id); 25 let parse = db.parse(position.file_id);