@@ -13,7 +13,7 @@ use ra_ide::{
13
13
AssistId , FileId , FilePosition , FileRange , Query , Runnable , RunnableKind , SearchScope ,
14
14
} ;
15
15
use ra_prof:: profile;
16
- use ra_syntax:: { tokenize , AstNode , SyntaxKind , TextRange , TextUnit } ;
16
+ use ra_syntax:: { AstNode , SyntaxKind , TextRange , TextUnit } ;
17
17
use rustc_hash:: FxHashMap ;
18
18
use serde:: { Deserialize , Serialize } ;
19
19
use serde_json:: to_value;
@@ -480,8 +480,6 @@ pub fn handle_prepare_rename(
480
480
let _p = profile ( "handle_prepare_rename" ) ;
481
481
let position = params. try_conv_with ( & world) ?;
482
482
483
- // We support renaming references like handle_rename does.
484
- // In the future we may want to reject the renaming of things like keywords here too.
485
483
let optional_change = world. analysis ( ) . rename ( position, "dummy" ) ?;
486
484
let range = match optional_change {
487
485
None => return Ok ( None ) ,
@@ -506,14 +504,6 @@ pub fn handle_rename(world: WorldSnapshot, params: RenameParams) -> Result<Optio
506
504
. into ( ) ) ;
507
505
}
508
506
509
- // Only rename to valid identifiers
510
- let tokens = tokenize ( & params. new_name ) ;
511
- if tokens. len ( ) != 1
512
- || ( tokens[ 0 ] . kind != SyntaxKind :: IDENT && tokens[ 0 ] . kind != SyntaxKind :: UNDERSCORE )
513
- {
514
- return Ok ( None ) ;
515
- }
516
-
517
507
let optional_change = world. analysis ( ) . rename ( position, & * params. new_name ) ?;
518
508
let change = match optional_change {
519
509
None => return Ok ( None ) ,
0 commit comments