aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_assists/src/handlers/early_return.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/early_return.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/early_return.rs')
-rw-r--r--crates/ide_assists/src/handlers/early_return.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/crates/ide_assists/src/handlers/early_return.rs b/crates/ide_assists/src/handlers/early_return.rs
index c66f8c05d..5eb6a57f0 100644
--- a/crates/ide_assists/src/handlers/early_return.rs
+++ b/crates/ide_assists/src/handlers/early_return.rs
@@ -130,9 +130,7 @@ pub(crate) fn convert_to_guarded_return(acc: &mut Assists, ctx: &AssistContext)
130 once(make::ident_pat(make::name("it")).into()), 130 once(make::ident_pat(make::name("it")).into()),
131 ); 131 );
132 let expr = { 132 let expr = {
133 let name_ref = make::name_ref("it"); 133 let path = make::ext::ident_path("it");
134 let segment = make::path_segment(name_ref);
135 let path = make::path_unqualified(segment);
136 make::expr_path(path) 134 make::expr_path(path)
137 }; 135 };
138 make::match_arm(once(pat.into()), expr) 136 make::match_arm(once(pat.into()), expr)