Only show self
ident when showing parameter self hints
This commit is contained in:
parent
245e1b533b
commit
74c82ca8ce
@ -162,7 +162,7 @@ fn get_param_name_hints(
|
||||
.zip(args)
|
||||
.filter_map(|((param, _ty), arg)| {
|
||||
let param_name = match param? {
|
||||
Either::Left(self_param) => self_param.to_string(),
|
||||
Either::Left(_) => "self".to_string(),
|
||||
Either::Right(pat) => match pat {
|
||||
ast::Pat::IdentPat(it) => it.name()?.to_string(),
|
||||
_ => return None,
|
||||
@ -809,7 +809,7 @@ fn main() {
|
||||
t.method(123);
|
||||
//^^^ param
|
||||
Test::method(&t, 3456);
|
||||
//^^ &self ^^^^ param
|
||||
//^^ self ^^^^ param
|
||||
Test::from_syntax(
|
||||
FileId {},
|
||||
//^^^^^^^^^ file_id
|
||||
@ -1360,4 +1360,25 @@ pub fn quux<T: Foo>() -> T::Bar {
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn self_param_hints() {
|
||||
check(
|
||||
r#"
|
||||
struct Foo;
|
||||
|
||||
impl Foo {
|
||||
fn foo(self: Self) {}
|
||||
fn bar(self: &Self) {}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
Foo::foo(Foo);
|
||||
//^^^ self
|
||||
Foo::bar(&Foo);
|
||||
//^^^^ self
|
||||
}
|
||||
"#,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user