File tree Expand file tree Collapse file tree 2 files changed +43
-4
lines changed Expand file tree Collapse file tree 2 files changed +43
-4
lines changed Original file line number Diff line number Diff line change @@ -671,6 +671,45 @@ fn main() {
671
671
);
672
672
}
673
673
674
+ #[test]
675
+ fn varaiant_with_struct() {
676
+ check_empty(
677
+ r#"
678
+ pub struct YoloVariant {
679
+ pub f: usize
680
+ }
681
+
682
+ pub enum HH {
683
+ Yolo(YoloVariant),
684
+ }
685
+
686
+ fn brr() {
687
+ let t = HH::Yolo(Y$0);
688
+ }
689
+ "#,
690
+ expect![[r#"
691
+ en HH
692
+ fn brr() fn()
693
+ st YoloVariant
694
+ st YoloVariant {…} YoloVariant { f: usize }
695
+ bt u32
696
+ kw crate::
697
+ kw false
698
+ kw for
699
+ kw if
700
+ kw if let
701
+ kw loop
702
+ kw match
703
+ kw return
704
+ kw self::
705
+ kw true
706
+ kw unsafe
707
+ kw while
708
+ kw while let
709
+ "#]],
710
+ );
711
+ }
712
+
674
713
#[test]
675
714
fn return_unit_block() {
676
715
cov_mark::check!(return_unit_block);
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use crate::RootDatabase;
12
12
#[derive(Debug)]
13
13
pub struct ActiveParameter {
14
14
pub ty: Type,
15
- pub pat: Either<ast::SelfParam, ast::Pat>,
15
+ pub pat: Option< Either<ast::SelfParam, ast::Pat> >,
16
16
}
17
17
18
18
impl ActiveParameter {
@@ -27,12 +27,12 @@ impl ActiveParameter {
27
27
return None;
28
28
}
29
29
let (pat, ty) = params.swap_remove(idx);
30
- pat.map(|pat| ActiveParameter { ty, pat })
30
+ Some( ActiveParameter { ty, pat })
31
31
}
32
32
33
33
pub fn ident(&self) -> Option<ast::Name> {
34
- self.pat.as_ref().right(). and_then(|param| match param {
35
- ast::Pat::IdentPat(ident) => ident.name(),
34
+ self.pat.as_ref().and_then(|param| match param {
35
+ Either::Right( ast::Pat::IdentPat(ident) ) => ident.name(),
36
36
_ => None,
37
37
})
38
38
}
You can’t perform that action at this time.
0 commit comments