mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge pull request #18649 from roife/fix-issue-18648
minor: enhance name suggestion for `Arc<T>` and `Rc<T>`
This commit is contained in:
commit
7b4b83ba91
1 changed files with 27 additions and 1 deletions
|
@ -29,7 +29,7 @@ const USELESS_NAME_PREFIXES: &[&str] = &["from_", "with_", "into_"];
|
|||
/// # Examples
|
||||
/// `Option<Name>` -> `Name`
|
||||
/// `Result<User, Error>` -> `User`
|
||||
const WRAPPER_TYPES: &[&str] = &["Box", "Option", "Result"];
|
||||
const WRAPPER_TYPES: &[&str] = &["Box", "Arc", "Rc", "Option", "Result"];
|
||||
|
||||
/// Prefixes to strip from methods names
|
||||
///
|
||||
|
@ -858,6 +858,32 @@ fn foo() { $0(bar())$0; }
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn arc_value() {
|
||||
check(
|
||||
r#"
|
||||
struct Arc<T>(*const T);
|
||||
struct Seed;
|
||||
fn bar() -> Arc<Seed> {}
|
||||
fn foo() { $0(bar())$0; }
|
||||
"#,
|
||||
"seed",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn rc_value() {
|
||||
check(
|
||||
r#"
|
||||
struct Rc<T>(*const T);
|
||||
struct Seed;
|
||||
fn bar() -> Rc<Seed> {}
|
||||
fn foo() { $0(bar())$0; }
|
||||
"#,
|
||||
"seed",
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ref_call() {
|
||||
check(
|
||||
|
|
Loading…
Reference in a new issue