Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-db/src/syntax_helpers/suggest_name.rs')
| -rw-r--r-- | crates/ide-db/src/syntax_helpers/suggest_name.rs | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/crates/ide-db/src/syntax_helpers/suggest_name.rs b/crates/ide-db/src/syntax_helpers/suggest_name.rs index 2679cbef61..b3ecc26cb2 100644 --- a/crates/ide-db/src/syntax_helpers/suggest_name.rs +++ b/crates/ide-db/src/syntax_helpers/suggest_name.rs @@ -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 /// @@ -859,6 +859,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( r#" |