diff options
Diffstat (limited to 'crates/ra_assists/src/assists/move_bounds.rs')
-rw-r--r-- | crates/ra_assists/src/assists/move_bounds.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/crates/ra_assists/src/assists/move_bounds.rs b/crates/ra_assists/src/assists/move_bounds.rs index d2444b6b9..f96e19a9f 100644 --- a/crates/ra_assists/src/assists/move_bounds.rs +++ b/crates/ra_assists/src/assists/move_bounds.rs | |||
@@ -1,5 +1,3 @@ | |||
1 | //! FIXME: write short doc here | ||
2 | |||
3 | use hir::db::HirDatabase; | 1 | use hir::db::HirDatabase; |
4 | use ra_syntax::{ | 2 | use ra_syntax::{ |
5 | ast::{self, edit, make, AstNode, NameOwner, TypeBoundsOwner}, | 3 | ast::{self, edit, make, AstNode, NameOwner, TypeBoundsOwner}, |
@@ -9,6 +7,21 @@ use ra_syntax::{ | |||
9 | 7 | ||
10 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
11 | 9 | ||
10 | // Assist: move_bounds_to_where_clause | ||
11 | // | ||
12 | // Moves inline type bounds to a where clause. | ||
13 | // | ||
14 | // ``` | ||
15 | // fn apply<T, U, <|>F: FnOnce(T) -> U>(f: F, x: T) -> U { | ||
16 | // f(x) | ||
17 | // } | ||
18 | // ``` | ||
19 | // -> | ||
20 | // ``` | ||
21 | // fn apply<T, U, F>(f: F, x: T) -> U where F: FnOnce(T) -> U { | ||
22 | // f(x) | ||
23 | // } | ||
24 | // ``` | ||
12 | pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { | 25 | pub(crate) fn move_bounds_to_where_clause(mut ctx: AssistCtx<impl HirDatabase>) -> Option<Assist> { |
13 | let type_param_list = ctx.node_at_offset::<ast::TypeParamList>()?; | 26 | let type_param_list = ctx.node_at_offset::<ast::TypeParamList>()?; |
14 | 27 | ||