Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide/src/rename.rs')
| -rw-r--r-- | crates/ide/src/rename.rs | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/crates/ide/src/rename.rs b/crates/ide/src/rename.rs index 07dfd83c4e..3e8295e3f0 100644 --- a/crates/ide/src/rename.rs +++ b/crates/ide/src/rename.rs @@ -71,13 +71,11 @@ pub(crate) fn prepare_rename( // // Renames the item below the cursor and all of its references // -// |=== -// | Editor | Shortcut +// | Editor | Shortcut | +// |---------|----------| +// | VS Code | <kbd>F2</kbd> | // -// | VS Code | kbd:[F2] -// |=== -// -// image::https://user-images.githubusercontent.com/48062697/113065582-055aae80-91b1-11eb-8ade-2b58e6d81883.gif[] +//  pub(crate) fn rename( db: &RootDatabase, position: FilePosition, @@ -2003,13 +2001,11 @@ impl Foo { "foo", r#" fn f($0self) -> i32 { - use self as _; self.i } "#, r#" fn f(foo: _) -> i32 { - use self as _; foo.i } "#, @@ -2017,6 +2013,26 @@ fn f(foo: _) -> i32 { } #[test] + fn no_type_value_ns_confuse() { + // Test that we don't rename items from different namespaces. + check( + "bar", + r#" +struct foo {} +fn f(foo$0: i32) -> i32 { + use foo as _; +} +"#, + r#" +struct foo {} +fn f(bar: i32) -> i32 { + use foo as _; +} +"#, + ); + } + + #[test] fn test_self_in_path_to_parameter() { check( "foo", |