diff options
author | Lukas Wirth <[email protected]> | 2021-02-12 20:30:55 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-02-12 20:30:55 +0000 |
commit | c395dd1032b66e28995189a26ed688b243d3cef8 (patch) | |
tree | be88733f10b9cd71bcff79b9c9a4dba7f6cbdf55 /crates/assists | |
parent | 88253907f4bc3beaa7b8f2e58cb652f653f92d56 (diff) |
Implement constructor usage search for almost all items
For all struct kinds, unions and enums, as well as for record- and
tuple-variants but not for unit-variants, as these have no trailing
character we can anchor the search to. Functionality wise it is
implemented though.
Diffstat (limited to 'crates/assists')
-rw-r--r-- | crates/assists/src/handlers/inline_local_variable.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/assists/src/handlers/inline_local_variable.rs b/crates/assists/src/handlers/inline_local_variable.rs index 8d28431cf..9b228443f 100644 --- a/crates/assists/src/handlers/inline_local_variable.rs +++ b/crates/assists/src/handlers/inline_local_variable.rs | |||
@@ -1,6 +1,5 @@ | |||
1 | use std::collections::HashMap; | ||
2 | |||
3 | use ide_db::{defs::Definition, search::FileReference}; | 1 | use ide_db::{defs::Definition, search::FileReference}; |
2 | use rustc_hash::FxHashMap; | ||
4 | use syntax::{ | 3 | use syntax::{ |
5 | ast::{self, AstNode, AstToken}, | 4 | ast::{self, AstNode, AstToken}, |
6 | TextRange, | 5 | TextRange, |
@@ -111,7 +110,7 @@ pub(crate) fn inline_local_variable(acc: &mut Assists, ctx: &AssistContext) -> O | |||
111 | .collect::<Result<_, _>>() | 110 | .collect::<Result<_, _>>() |
112 | .map(|b| (file_id, b)) | 111 | .map(|b| (file_id, b)) |
113 | }) | 112 | }) |
114 | .collect::<Result<HashMap<_, Vec<_>>, _>>()?; | 113 | .collect::<Result<FxHashMap<_, Vec<_>>, _>>()?; |
115 | 114 | ||
116 | let init_str = initializer_expr.syntax().text().to_string(); | 115 | let init_str = initializer_expr.syntax().text().to_string(); |
117 | let init_in_paren = format!("({})", &init_str); | 116 | let init_in_paren = format!("({})", &init_str); |