diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-11 09:22:09 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-11 09:22:09 +0000 |
commit | bf77850c8106a71b317fb6c707a28e00d258884c (patch) | |
tree | 314afb27e80d7de8ccaf3f2eaa7b2e309de2e87f /crates/ra_hir_def/src/nameres/tests | |
parent | 0714a065d578e8b22b0451bfc64378c875fe858f (diff) | |
parent | 13ccbb2919dff8e98d0a242d9d6b7edd17a6bd2c (diff) |
Merge #3542
3542: Renames work on struct field shorthands r=matklad a=m-n
When renaming either a local or a struct field, struct field shorthands are now renamed correctly.
Happy to refactor this if it doesn't fit the design of the code. Thanks for adding the suggestion of where to start on the issue.
I wasn't sure if I should also look at the behavior of renaming when placing the cursor at the field shorthand; the following describes the behavior with this patch:
```rust
#[test]
fn test_rename_field_shorthand_for_unspecified() {
// when renaming a shorthand, should we have a way to specify
// between renaming the field and the local?
//
// If not is this the correct default?
test_rename(
r#"
struct Foo {
i: i32,
}
impl Foo {
fn new(i: i32) -> Self {
Self { i<|> }
}
}
"#,
"j",
r#"
struct Foo {
i: i32,
}
impl Foo {
fn new(j: i32) -> Self {
Self { i: j }
}
}
"#,
);
}
```
Resolves #3431
Co-authored-by: Matt Niemeir <[email protected]>
Diffstat (limited to 'crates/ra_hir_def/src/nameres/tests')
0 files changed, 0 insertions, 0 deletions