mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-15 18:19:07 +00:00
Remove rename_self_outside_of_methods
This commit is contained in:
parent
4b32a49ef1
commit
9ecd82be13
1 changed files with 2 additions and 8 deletions
|
|
@ -473,12 +473,7 @@ fn text_edit_from_self_param(self_param: &ast::SelfParam, new_name: String) -> O
|
||||||
replacement_text.push_str("mut ");
|
replacement_text.push_str("mut ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if self_param.syntax().ancestors().find_map(ast::Impl::cast).is_some() {
|
|
||||||
replacement_text.push_str("Self");
|
replacement_text.push_str("Self");
|
||||||
} else {
|
|
||||||
cov_mark::hit!(rename_self_outside_of_methods);
|
|
||||||
replacement_text.push('_');
|
|
||||||
}
|
|
||||||
|
|
||||||
Some(TextEdit::replace(self_param.syntax().text_range(), replacement_text))
|
Some(TextEdit::replace(self_param.syntax().text_range(), replacement_text))
|
||||||
}
|
}
|
||||||
|
|
@ -2124,7 +2119,6 @@ impl<'a> Foo<'a> {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_self_outside_of_methods() {
|
fn test_self_outside_of_methods() {
|
||||||
cov_mark::check!(rename_self_outside_of_methods);
|
|
||||||
check(
|
check(
|
||||||
"foo",
|
"foo",
|
||||||
r#"
|
r#"
|
||||||
|
|
@ -2133,7 +2127,7 @@ fn f($0self) -> i32 {
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
r#"
|
r#"
|
||||||
fn f(foo: _) -> i32 {
|
fn f(foo: Self) -> i32 {
|
||||||
foo.i
|
foo.i
|
||||||
}
|
}
|
||||||
"#,
|
"#,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue