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() {
671671 ) ;
672672}
673673
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+
674713#[ test]
675714fn return_unit_block ( ) {
676715 cov_mark:: check!( return_unit_block) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ use crate::RootDatabase;
1212#[ derive( Debug ) ]
1313pub struct ActiveParameter {
1414 pub ty : Type ,
15- pub pat : Either < ast:: SelfParam , ast:: Pat > ,
15+ pub pat : Option < Either < ast:: SelfParam , ast:: Pat > > ,
1616}
1717
1818impl ActiveParameter {
@@ -27,12 +27,12 @@ impl ActiveParameter {
2727 return None ;
2828 }
2929 let ( pat, ty) = params. swap_remove ( idx) ;
30- pat . map ( |pat| ActiveParameter { ty, pat } )
30+ Some ( ActiveParameter { ty, pat } )
3131 }
3232
3333 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 ( ) ,
3636 _ => None ,
3737 } )
3838 }
You can’t perform that action at this time.
0 commit comments