aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/assists
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-09-25 13:16:18 +0100
committerAleksey Kladov <[email protected]>2019-09-25 13:26:05 +0100
commit546f031e4e643c7cc4df44a2a09ac7c4af5e5ad7 (patch)
tree0966100a969ea40544aba805eed93711fb3a85ba /crates/ra_assists/src/assists
parent25fca0475343170b8398f5c87c76c455205ed3c4 (diff)
minor builder cleanups
Diffstat (limited to 'crates/ra_assists/src/assists')
-rw-r--r--crates/ra_assists/src/assists/add_missing_impl_members.rs2
-rw-r--r--crates/ra_assists/src/assists/fill_match_arms.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_assists/src/assists/add_missing_impl_members.rs b/crates/ra_assists/src/assists/add_missing_impl_members.rs
index 2894bdd8a..11d69a04b 100644
--- a/crates/ra_assists/src/assists/add_missing_impl_members.rs
+++ b/crates/ra_assists/src/assists/add_missing_impl_members.rs
@@ -103,7 +103,7 @@ fn add_body(fn_def: ast::FnDef) -> ast::FnDef {
103 let mut ast_editor = AstEditor::new(fn_def.clone()); 103 let mut ast_editor = AstEditor::new(fn_def.clone());
104 if fn_def.body().is_none() { 104 if fn_def.body().is_none() {
105 ast_editor.set_body(&AstBuilder::<ast::Block>::single_expr( 105 ast_editor.set_body(&AstBuilder::<ast::Block>::single_expr(
106 &AstBuilder::<ast::Expr>::unimplemented(), 106 AstBuilder::<ast::Expr>::unimplemented(),
107 )); 107 ));
108 } 108 }
109 ast_editor.ast().to_owned() 109 ast_editor.ast().to_owned()
diff --git a/crates/ra_assists/src/assists/fill_match_arms.rs b/crates/ra_assists/src/assists/fill_match_arms.rs
index 771aa625f..f1c36b805 100644
--- a/crates/ra_assists/src/assists/fill_match_arms.rs
+++ b/crates/ra_assists/src/assists/fill_match_arms.rs
@@ -32,7 +32,7 @@ pub(crate) fn fill_match_arms(mut ctx: AssistCtx<impl HirDatabase>) -> Option<As
32 let arms = variants.filter_map(build_pat).map(|pat| { 32 let arms = variants.filter_map(build_pat).map(|pat| {
33 AstBuilder::<ast::MatchArm>::from_pieces( 33 AstBuilder::<ast::MatchArm>::from_pieces(
34 iter::once(pat), 34 iter::once(pat),
35 &AstBuilder::<ast::Expr>::unit(), 35 AstBuilder::<ast::Expr>::unit(),
36 ) 36 )
37 }); 37 });
38 let new_arm_list = AstBuilder::<ast::MatchArmList>::from_arms(arms); 38 let new_arm_list = AstBuilder::<ast::MatchArmList>::from_arms(arms);
@@ -66,7 +66,7 @@ fn resolve_enum_def(
66} 66}
67 67
68fn build_pat(var: ast::EnumVariant) -> Option<ast::Pat> { 68fn build_pat(var: ast::EnumVariant) -> Option<ast::Pat> {
69 let path = &AstBuilder::<ast::Path>::from_pieces(var.parent_enum().name()?, var.name()?); 69 let path = AstBuilder::<ast::Path>::from_pieces(var.parent_enum().name()?, var.name()?);
70 70
71 let pat: ast::Pat = match var.kind() { 71 let pat: ast::Pat = match var.kind() {
72 ast::StructKind::Tuple(field_list) => { 72 ast::StructKind::Tuple(field_list) => {
@@ -77,7 +77,7 @@ fn build_pat(var: ast::EnumVariant) -> Option<ast::Pat> {
77 ast::StructKind::Named(field_list) => { 77 ast::StructKind::Named(field_list) => {
78 let pats = field_list 78 let pats = field_list
79 .fields() 79 .fields()
80 .map(|f| AstBuilder::<ast::BindPat>::from_name(&f.name().unwrap()).into()); 80 .map(|f| AstBuilder::<ast::BindPat>::from_name(f.name().unwrap()).into());
81 AstBuilder::<ast::RecordPat>::from_pieces(path, pats).into() 81 AstBuilder::<ast::RecordPat>::from_pieces(path, pats).into()
82 } 82 }
83 ast::StructKind::Unit => AstBuilder::<ast::PathPat>::from_path(path).into(), 83 ast::StructKind::Unit => AstBuilder::<ast::PathPat>::from_path(path).into(),