mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 07:04:49 +00:00
minor: enhance name suggestion for Arc<T>
and Rc<T>
This commit is contained in:
parent
99a6ecd41e
commit
9c03cbb499
1 changed files with 27 additions and 1 deletions
|
@ -29,7 +29,7 @@ const USELESS_NAME_PREFIXES: &[&str] = &["from_", "with_", "into_"];
|
||||||
/// # Examples
|
/// # Examples
|
||||||
/// `Option<Name>` -> `Name`
|
/// `Option<Name>` -> `Name`
|
||||||
/// `Result<User, Error>` -> `User`
|
/// `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
|
/// 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]
|
#[test]
|
||||||
fn ref_call() {
|
fn ref_call() {
|
||||||
check(
|
check(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue