@@ -23,7 +23,7 @@ use ra_ide_db::RootDatabase;
2323use ra_syntax:: { TextRange , TextSize } ;
2424use ra_text_edit:: TextEdit ;
2525
26- pub ( crate ) use crate :: assist_ctx:: { Assist , AssistCtx , AssistHandler } ;
26+ pub ( crate ) use crate :: assist_ctx:: { Assist , AssistCtx } ;
2727
2828/// Unique identifier of the assist, should not be shown to the user
2929/// directly.
@@ -109,7 +109,9 @@ pub fn resolved_assists(db: &RootDatabase, range: FileRange) -> Vec<ResolvedAssi
109109}
110110
111111mod handlers {
112- use crate :: AssistHandler ;
112+ use crate :: { Assist , AssistCtx } ;
113+
114+ pub ( crate ) type Handler = fn ( AssistCtx ) -> Option < Assist > ;
113115
114116 mod add_custom_impl;
115117 mod add_derive;
@@ -145,12 +147,13 @@ mod handlers {
145147 mod reorder_fields;
146148 mod unwrap_block;
147149
148- pub ( crate ) fn all ( ) -> & ' static [ AssistHandler ] {
150+ pub ( crate ) fn all ( ) -> & ' static [ Handler ] {
149151 & [
150152 // These are alphabetic for the foolish consistency
151153 add_custom_impl:: add_custom_impl,
152154 add_derive:: add_derive,
153155 add_explicit_type:: add_explicit_type,
156+ add_from_impl_for_enum:: add_from_impl_for_enum,
154157 add_function:: add_function,
155158 add_impl:: add_impl,
156159 add_new:: add_new,
@@ -176,17 +179,18 @@ mod handlers {
176179 raw_string:: remove_hash,
177180 remove_dbg:: remove_dbg,
178181 remove_mut:: remove_mut,
182+ reorder_fields:: reorder_fields,
179183 replace_if_let_with_match:: replace_if_let_with_match,
180184 replace_let_with_if_let:: replace_let_with_if_let,
181185 replace_qualified_name_with_use:: replace_qualified_name_with_use,
182186 replace_unwrap_with_match:: replace_unwrap_with_match,
183187 split_import:: split_import,
184- add_from_impl_for_enum:: add_from_impl_for_enum,
185188 unwrap_block:: unwrap_block,
186189 // These are manually sorted for better priorities
187190 add_missing_impl_members:: add_missing_impl_members,
188191 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?
190194 ]
191195 }
192196}
0 commit comments