@@ -23,7 +23,7 @@ use ra_ide_db::RootDatabase;
23
23
use ra_syntax:: { TextRange , TextSize } ;
24
24
use ra_text_edit:: TextEdit ;
25
25
26
- pub ( crate ) use crate :: assist_ctx:: { Assist , AssistCtx , AssistHandler } ;
26
+ pub ( crate ) use crate :: assist_ctx:: { Assist , AssistCtx } ;
27
27
28
28
/// Unique identifier of the assist, should not be shown to the user
29
29
/// directly.
@@ -109,7 +109,9 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssi
109
109
}
110
110
111
111
mod handlers {
112
- use crate :: AssistHandler ;
112
+ use crate :: { Assist , AssistCtx } ;
113
+
114
+ pub ( crate ) type Handler = fn ( AssistCtx ) -> Option < Assist > ;
113
115
114
116
mod add_custom_impl;
115
117
mod add_derive;
@@ -145,12 +147,13 @@ mod handlers {
145
147
mod reorder_fields;
146
148
mod unwrap_block;
147
149
148
- pub ( crate ) fn all ( ) -> & ' static [ AssistHandler ] {
150
+ pub ( crate ) fn all ( ) -> & ' static [ Handler ] {
149
151
& [
150
152
// These are alphabetic for the foolish consistency
151
153
add_custom_impl:: add_custom_impl,
152
154
add_derive:: add_derive,
153
155
add_explicit_type:: add_explicit_type,
156
+ add_from_impl_for_enum:: add_from_impl_for_enum,
154
157
add_function:: add_function,
155
158
add_impl:: add_impl,
156
159
add_new:: add_new,
@@ -176,17 +179,18 @@ mod handlers {
176
179
raw_string:: remove_hash,
177
180
remove_dbg:: remove_dbg,
178
181
remove_mut:: remove_mut,
182
+ reorder_fields:: reorder_fields,
179
183
replace_if_let_with_match:: replace_if_let_with_match,
180
184
replace_let_with_if_let:: replace_let_with_if_let,
181
185
replace_qualified_name_with_use:: replace_qualified_name_with_use,
182
186
replace_unwrap_with_match:: replace_unwrap_with_match,
183
187
split_import:: split_import,
184
- add_from_impl_for_enum:: add_from_impl_for_enum,
185
188
unwrap_block:: unwrap_block,
186
189
// These are manually sorted for better priorities
187
190
add_missing_impl_members:: add_missing_impl_members,
188
191
add_missing_impl_members:: add_missing_default_members,
189
- reorder_fields:: reorder_fields,
192
+ // Are you sure you want to add new assist here, and not to the
193
+ // sorted list above?
190
194
]
191
195
}
192
196
}
0 commit comments