aboutsummaryrefslogtreecommitdiff
path: root/crates/assists
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2021-02-12 20:30:55 +0000
committerLukas Wirth <[email protected]>2021-02-12 20:30:55 +0000
commitc395dd1032b66e28995189a26ed688b243d3cef8 (patch)
treebe88733f10b9cd71bcff79b9c9a4dba7f6cbdf55 /crates/assists
parent88253907f4bc3beaa7b8f2e58cb652f653f92d56 (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.rs5
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 @@
1use std::collections::HashMap;
2
3use ide_db::{defs::Definition, search::FileReference}; 1use ide_db::{defs::Definition, search::FileReference};
2use rustc_hash::FxHashMap;
4use syntax::{ 3use 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);