aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers/move_bounds.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-05-09 17:51:06 +0100
committerAleksey Kladov <[email protected]>2021-05-09 17:55:43 +0100
commit4f3c0adc5aafea465c71c85f36484da970df1ba2 (patch)
tree4cb502a6c345c3ecfb4090067ab1de2cfd69ed55 /crates/ide_assists/src/handlers/move_bounds.rs
parent680a0d54e4d2d474ae41f4f4a95c749495a02883 (diff)
internal: introduce `ast::make::ext` module with common shortcuts
There's a tension between keeping a well-architectured minimal orthogonal set of constructs, and providing convenience functions. Relieve this pressure by introducing an dedicated module for non-orthogonal shortcuts. This is inspired by the django.shortcuts module which serves a similar purpose architecturally.
Diffstat (limited to 'crates/ide_assists/src/handlers/move_bounds.rs')
-rw-r--r--crates/ide_assists/src/handlers/move_bounds.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/crates/ide_assists/src/handlers/move_bounds.rs b/crates/ide_assists/src/handlers/move_bounds.rs
index 011a28d44..fa3f76609 100644
--- a/crates/ide_assists/src/handlers/move_bounds.rs
+++ b/crates/ide_assists/src/handlers/move_bounds.rs
@@ -63,11 +63,7 @@ pub(crate) fn move_bounds_to_where_clause(acc: &mut Assists, ctx: &AssistContext
63} 63}
64 64
65fn build_predicate(param: ast::TypeParam) -> Option<ast::WherePred> { 65fn build_predicate(param: ast::TypeParam) -> Option<ast::WherePred> {
66 let path = { 66 let path = make::ext::ident_path(&param.name()?.syntax().to_string());
67 let name_ref = make::name_ref(&param.name()?.syntax().to_string());
68 let segment = make::path_segment(name_ref);
69 make::path_unqualified(segment)
70 };
71 let predicate = make::where_pred(path, param.type_bound_list()?.bounds()); 67 let predicate = make::where_pred(path, param.type_bound_list()?.bounds());
72 Some(predicate.clone_for_update()) 68 Some(predicate.clone_for_update())
73} 69}