diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-03-31 13:53:51 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-03-31 13:53:51 +0100 |
commit | 2cdeb7363a85081803fca184bb603b8e6a61def3 (patch) | |
tree | 59d1a0da950bdf4fb33f48871ccf7c8d0fc3561b /crates/ra_assists | |
parent | d63bb8565e129f51fadf6a036683b1eedefb78dd (diff) | |
parent | 2fe6e23138d990a852a59d9680847cb6718565bb (diff) |
Merge #3786
3786: When adding match arm, don't let the floating comma r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_assists')
-rw-r--r-- | crates/ra_assists/src/handlers/fill_match_arms.rs | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/crates/ra_assists/src/handlers/fill_match_arms.rs b/crates/ra_assists/src/handlers/fill_match_arms.rs index 41bb97928..8d1af9933 100644 --- a/crates/ra_assists/src/handlers/fill_match_arms.rs +++ b/crates/ra_assists/src/handlers/fill_match_arms.rs | |||
@@ -1,15 +1,11 @@ | |||
1 | //! FIXME: write short doc here | ||
2 | |||
3 | use std::iter; | 1 | use std::iter; |
4 | 2 | ||
5 | use hir::{Adt, HasSource, ModuleDef, Semantics}; | 3 | use hir::{Adt, HasSource, ModuleDef, Semantics}; |
6 | use itertools::Itertools; | 4 | use itertools::Itertools; |
7 | use ra_ide_db::RootDatabase; | 5 | use ra_ide_db::RootDatabase; |
6 | use ra_syntax::ast::{self, make, AstNode, MatchArm, NameOwner, Pat}; | ||
8 | 7 | ||
9 | use crate::{Assist, AssistCtx, AssistId}; | 8 | use crate::{Assist, AssistCtx, AssistId}; |
10 | use ra_syntax::ast::{self, make, AstNode, NameOwner}; | ||
11 | |||
12 | use ast::{MatchArm, Pat}; | ||
13 | 9 | ||
14 | // Assist: fill_match_arms | 10 | // Assist: fill_match_arms |
15 | // | 11 | // |
@@ -717,4 +713,28 @@ mod tests { | |||
717 | "#, | 713 | "#, |
718 | ); | 714 | ); |
719 | } | 715 | } |
716 | |||
717 | #[test] | ||
718 | fn fill_match_arms_placeholder() { | ||
719 | check_assist( | ||
720 | fill_match_arms, | ||
721 | r#" | ||
722 | enum A { One, Two, } | ||
723 | fn foo(a: A) { | ||
724 | match a<|> { | ||
725 | _ => (), | ||
726 | } | ||
727 | } | ||
728 | "#, | ||
729 | r#" | ||
730 | enum A { One, Two, } | ||
731 | fn foo(a: A) { | ||
732 | match <|>a { | ||
733 | A::One => {} | ||
734 | A::Two => {} | ||
735 | } | ||
736 | } | ||
737 | "#, | ||
738 | ); | ||
739 | } | ||
720 | } | 740 | } |