diff options
Diffstat (limited to 'crates/ide_diagnostics/src/handlers/missing_match_arms.rs')
-rw-r--r-- | crates/ide_diagnostics/src/handlers/missing_match_arms.rs | 96 |
1 files changed, 48 insertions, 48 deletions
diff --git a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs index 9ea533d74..947b0f2e2 100644 --- a/crates/ide_diagnostics/src/handlers/missing_match_arms.rs +++ b/crates/ide_diagnostics/src/handlers/missing_match_arms.rs | |||
@@ -31,9 +31,9 @@ mod tests { | |||
31 | r#" | 31 | r#" |
32 | fn main() { | 32 | fn main() { |
33 | match () { } | 33 | match () { } |
34 | //^^ missing match arm | 34 | //^^ error: missing match arm |
35 | match (()) { } | 35 | match (()) { } |
36 | //^^^^ missing match arm | 36 | //^^^^ error: missing match arm |
37 | 37 | ||
38 | match () { _ => (), } | 38 | match () { _ => (), } |
39 | match () { () => (), } | 39 | match () { () => (), } |
@@ -49,7 +49,7 @@ fn main() { | |||
49 | r#" | 49 | r#" |
50 | fn main() { | 50 | fn main() { |
51 | match ((), ()) { } | 51 | match ((), ()) { } |
52 | //^^^^^^^^ missing match arm | 52 | //^^^^^^^^ error: missing match arm |
53 | 53 | ||
54 | match ((), ()) { ((), ()) => (), } | 54 | match ((), ()) { ((), ()) => (), } |
55 | } | 55 | } |
@@ -63,21 +63,21 @@ fn main() { | |||
63 | r#" | 63 | r#" |
64 | fn test_main() { | 64 | fn test_main() { |
65 | match false { } | 65 | match false { } |
66 | //^^^^^ missing match arm | 66 | //^^^^^ error: missing match arm |
67 | match false { true => (), } | 67 | match false { true => (), } |
68 | //^^^^^ missing match arm | 68 | //^^^^^ error: missing match arm |
69 | match (false, true) {} | 69 | match (false, true) {} |
70 | //^^^^^^^^^^^^^ missing match arm | 70 | //^^^^^^^^^^^^^ error: missing match arm |
71 | match (false, true) { (true, true) => (), } | 71 | match (false, true) { (true, true) => (), } |
72 | //^^^^^^^^^^^^^ missing match arm | 72 | //^^^^^^^^^^^^^ error: missing match arm |
73 | match (false, true) { | 73 | match (false, true) { |
74 | //^^^^^^^^^^^^^ missing match arm | 74 | //^^^^^^^^^^^^^ error: missing match arm |
75 | (false, true) => (), | 75 | (false, true) => (), |
76 | (false, false) => (), | 76 | (false, false) => (), |
77 | (true, false) => (), | 77 | (true, false) => (), |
78 | } | 78 | } |
79 | match (false, true) { (true, _x) => (), } | 79 | match (false, true) { (true, _x) => (), } |
80 | //^^^^^^^^^^^^^ missing match arm | 80 | //^^^^^^^^^^^^^ error: missing match arm |
81 | 81 | ||
82 | match false { true => (), false => (), } | 82 | match false { true => (), false => (), } |
83 | match (false, true) { | 83 | match (false, true) { |
@@ -116,11 +116,11 @@ fn test_main() { | |||
116 | r#" | 116 | r#" |
117 | fn main() { | 117 | fn main() { |
118 | match (false, ((), false)) {} | 118 | match (false, ((), false)) {} |
119 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 119 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
120 | match (false, ((), false)) { (true, ((), true)) => (), } | 120 | match (false, ((), false)) { (true, ((), true)) => (), } |
121 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 121 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
122 | match (false, ((), false)) { (true, _) => (), } | 122 | match (false, ((), false)) { (true, _) => (), } |
123 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 123 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
124 | 124 | ||
125 | match (false, ((), false)) { | 125 | match (false, ((), false)) { |
126 | (true, ((), true)) => (), | 126 | (true, ((), true)) => (), |
@@ -146,12 +146,12 @@ enum Either { A, B, } | |||
146 | 146 | ||
147 | fn main() { | 147 | fn main() { |
148 | match Either::A { } | 148 | match Either::A { } |
149 | //^^^^^^^^^ missing match arm | 149 | //^^^^^^^^^ error: missing match arm |
150 | match Either::B { Either::A => (), } | 150 | match Either::B { Either::A => (), } |
151 | //^^^^^^^^^ missing match arm | 151 | //^^^^^^^^^ error: missing match arm |
152 | 152 | ||
153 | match &Either::B { | 153 | match &Either::B { |
154 | //^^^^^^^^^^ missing match arm | 154 | //^^^^^^^^^^ error: missing match arm |
155 | Either::A => (), | 155 | Either::A => (), |
156 | } | 156 | } |
157 | 157 | ||
@@ -174,9 +174,9 @@ enum Either { A(bool), B } | |||
174 | 174 | ||
175 | fn main() { | 175 | fn main() { |
176 | match Either::B { } | 176 | match Either::B { } |
177 | //^^^^^^^^^ missing match arm | 177 | //^^^^^^^^^ error: missing match arm |
178 | match Either::B { | 178 | match Either::B { |
179 | //^^^^^^^^^ missing match arm | 179 | //^^^^^^^^^ error: missing match arm |
180 | Either::A(true) => (), Either::B => () | 180 | Either::A(true) => (), Either::B => () |
181 | } | 181 | } |
182 | 182 | ||
@@ -207,7 +207,7 @@ enum Either { A(bool), B(bool, bool) } | |||
207 | 207 | ||
208 | fn main() { | 208 | fn main() { |
209 | match Either::A(false) { | 209 | match Either::A(false) { |
210 | //^^^^^^^^^^^^^^^^ missing match arm | 210 | //^^^^^^^^^^^^^^^^ error: missing match arm |
211 | Either::A(_) => (), | 211 | Either::A(_) => (), |
212 | Either::B(false, _) => (), | 212 | Either::B(false, _) => (), |
213 | } | 213 | } |
@@ -352,7 +352,7 @@ fn main() { | |||
352 | Either::A => (), | 352 | Either::A => (), |
353 | } | 353 | } |
354 | match loop { break Foo::A } { | 354 | match loop { break Foo::A } { |
355 | //^^^^^^^^^^^^^^^^^^^^^ missing match arm | 355 | //^^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
356 | Either::A => (), | 356 | Either::A => (), |
357 | } | 357 | } |
358 | match loop { break Foo::A } { | 358 | match loop { break Foo::A } { |
@@ -390,19 +390,19 @@ enum Either { A { foo: bool }, B } | |||
390 | fn main() { | 390 | fn main() { |
391 | let a = Either::A { foo: true }; | 391 | let a = Either::A { foo: true }; |
392 | match a { } | 392 | match a { } |
393 | //^ missing match arm | 393 | //^ error: missing match arm |
394 | match a { Either::A { foo: true } => () } | 394 | match a { Either::A { foo: true } => () } |
395 | //^ missing match arm | 395 | //^ error: missing match arm |
396 | match a { | 396 | match a { |
397 | Either::A { } => (), | 397 | Either::A { } => (), |
398 | //^^^^^^^^^ Missing structure fields: | 398 | //^^^^^^^^^ error: missing structure fields: |
399 | // | - foo | 399 | // | - foo |
400 | Either::B => (), | 400 | Either::B => (), |
401 | } | 401 | } |
402 | match a { | 402 | match a { |
403 | //^ missing match arm | 403 | //^ error: missing match arm |
404 | Either::A { } => (), | 404 | Either::A { } => (), |
405 | } //^^^^^^^^^ Missing structure fields: | 405 | } //^^^^^^^^^ error: missing structure fields: |
406 | // | - foo | 406 | // | - foo |
407 | 407 | ||
408 | match a { | 408 | match a { |
@@ -431,7 +431,7 @@ enum Either { | |||
431 | fn main() { | 431 | fn main() { |
432 | let a = Either::A { foo: true, bar: () }; | 432 | let a = Either::A { foo: true, bar: () }; |
433 | match a { | 433 | match a { |
434 | //^ missing match arm | 434 | //^ error: missing match arm |
435 | Either::A { bar: (), foo: false } => (), | 435 | Either::A { bar: (), foo: false } => (), |
436 | Either::A { foo: true, bar: () } => (), | 436 | Either::A { foo: true, bar: () } => (), |
437 | } | 437 | } |
@@ -458,12 +458,12 @@ enum Either { | |||
458 | fn main() { | 458 | fn main() { |
459 | let a = Either::B; | 459 | let a = Either::B; |
460 | match a { | 460 | match a { |
461 | //^ missing match arm | 461 | //^ error: missing match arm |
462 | Either::A { foo: true, .. } => (), | 462 | Either::A { foo: true, .. } => (), |
463 | Either::B => (), | 463 | Either::B => (), |
464 | } | 464 | } |
465 | match a { | 465 | match a { |
466 | //^ missing match arm | 466 | //^ error: missing match arm |
467 | Either::A { .. } => (), | 467 | Either::A { .. } => (), |
468 | } | 468 | } |
469 | 469 | ||
@@ -493,14 +493,14 @@ enum Either { | |||
493 | 493 | ||
494 | fn main() { | 494 | fn main() { |
495 | match Either::B { | 495 | match Either::B { |
496 | //^^^^^^^^^ missing match arm | 496 | //^^^^^^^^^ error: missing match arm |
497 | Either::A(true, .., true) => (), | 497 | Either::A(true, .., true) => (), |
498 | Either::A(true, .., false) => (), | 498 | Either::A(true, .., false) => (), |
499 | Either::A(false, .., false) => (), | 499 | Either::A(false, .., false) => (), |
500 | Either::B => (), | 500 | Either::B => (), |
501 | } | 501 | } |
502 | match Either::B { | 502 | match Either::B { |
503 | //^^^^^^^^^ missing match arm | 503 | //^^^^^^^^^ error: missing match arm |
504 | Either::A(true, .., true) => (), | 504 | Either::A(true, .., true) => (), |
505 | Either::A(true, .., false) => (), | 505 | Either::A(true, .., false) => (), |
506 | Either::A(.., true) => (), | 506 | Either::A(.., true) => (), |
@@ -537,7 +537,7 @@ fn enum_(never: Never) { | |||
537 | } | 537 | } |
538 | fn enum_ref(never: &Never) { | 538 | fn enum_ref(never: &Never) { |
539 | match never {} | 539 | match never {} |
540 | //^^^^^ missing match arm | 540 | //^^^^^ error: missing match arm |
541 | } | 541 | } |
542 | fn bang(never: !) { | 542 | fn bang(never: !) { |
543 | match never {} | 543 | match never {} |
@@ -561,7 +561,7 @@ fn main() { | |||
561 | Some(never) => match never {}, | 561 | Some(never) => match never {}, |
562 | } | 562 | } |
563 | match Option::<Never>::None { | 563 | match Option::<Never>::None { |
564 | //^^^^^^^^^^^^^^^^^^^^^ missing match arm | 564 | //^^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
565 | Option::Some(_never) => {}, | 565 | Option::Some(_never) => {}, |
566 | } | 566 | } |
567 | } | 567 | } |
@@ -575,7 +575,7 @@ fn main() { | |||
575 | r#" | 575 | r#" |
576 | fn main() { | 576 | fn main() { |
577 | match (false, true, false) { | 577 | match (false, true, false) { |
578 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 578 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
579 | (false, ..) => (), | 579 | (false, ..) => (), |
580 | } | 580 | } |
581 | }"#, | 581 | }"#, |
@@ -588,7 +588,7 @@ fn main() { | |||
588 | r#" | 588 | r#" |
589 | fn main() { | 589 | fn main() { |
590 | match (false, true, false) { | 590 | match (false, true, false) { |
591 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 591 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
592 | (.., false) => (), | 592 | (.., false) => (), |
593 | } | 593 | } |
594 | }"#, | 594 | }"#, |
@@ -601,7 +601,7 @@ fn main() { | |||
601 | r#" | 601 | r#" |
602 | fn main() { | 602 | fn main() { |
603 | match (false, true, false) { | 603 | match (false, true, false) { |
604 | //^^^^^^^^^^^^^^^^^^^^ missing match arm | 604 | //^^^^^^^^^^^^^^^^^^^^ error: missing match arm |
605 | (true, .., false) => (), | 605 | (true, .., false) => (), |
606 | } | 606 | } |
607 | }"#, | 607 | }"#, |
@@ -614,11 +614,11 @@ fn main() { | |||
614 | r#"struct Foo { a: bool } | 614 | r#"struct Foo { a: bool } |
615 | fn main(f: Foo) { | 615 | fn main(f: Foo) { |
616 | match f {} | 616 | match f {} |
617 | //^ missing match arm | 617 | //^ error: missing match arm |
618 | match f { Foo { a: true } => () } | 618 | match f { Foo { a: true } => () } |
619 | //^ missing match arm | 619 | //^ error: missing match arm |
620 | match &f { Foo { a: true } => () } | 620 | match &f { Foo { a: true } => () } |
621 | //^^ missing match arm | 621 | //^^ error: missing match arm |
622 | match f { Foo { a: _ } => () } | 622 | match f { Foo { a: _ } => () } |
623 | match f { | 623 | match f { |
624 | Foo { a: true } => (), | 624 | Foo { a: true } => (), |
@@ -639,9 +639,9 @@ fn main(f: Foo) { | |||
639 | r#"struct Foo(bool); | 639 | r#"struct Foo(bool); |
640 | fn main(f: Foo) { | 640 | fn main(f: Foo) { |
641 | match f {} | 641 | match f {} |
642 | //^ missing match arm | 642 | //^ error: missing match arm |
643 | match f { Foo(true) => () } | 643 | match f { Foo(true) => () } |
644 | //^ missing match arm | 644 | //^ error: missing match arm |
645 | match f { | 645 | match f { |
646 | Foo(true) => (), | 646 | Foo(true) => (), |
647 | Foo(false) => (), | 647 | Foo(false) => (), |
@@ -657,7 +657,7 @@ fn main(f: Foo) { | |||
657 | r#"struct Foo; | 657 | r#"struct Foo; |
658 | fn main(f: Foo) { | 658 | fn main(f: Foo) { |
659 | match f {} | 659 | match f {} |
660 | //^ missing match arm | 660 | //^ error: missing match arm |
661 | match f { Foo => () } | 661 | match f { Foo => () } |
662 | } | 662 | } |
663 | "#, | 663 | "#, |
@@ -670,9 +670,9 @@ fn main(f: Foo) { | |||
670 | r#"struct Foo { foo: bool, bar: bool } | 670 | r#"struct Foo { foo: bool, bar: bool } |
671 | fn main(f: Foo) { | 671 | fn main(f: Foo) { |
672 | match f { Foo { foo: true, .. } => () } | 672 | match f { Foo { foo: true, .. } => () } |
673 | //^ missing match arm | 673 | //^ error: missing match arm |
674 | match f { | 674 | match f { |
675 | //^ missing match arm | 675 | //^ error: missing match arm |
676 | Foo { foo: true, .. } => (), | 676 | Foo { foo: true, .. } => (), |
677 | Foo { bar: false, .. } => () | 677 | Foo { bar: false, .. } => () |
678 | } | 678 | } |
@@ -693,7 +693,7 @@ fn main(f: Foo) { | |||
693 | fn main() { | 693 | fn main() { |
694 | enum Either { A(bool), B } | 694 | enum Either { A(bool), B } |
695 | match Either::B { | 695 | match Either::B { |
696 | //^^^^^^^^^ missing match arm | 696 | //^^^^^^^^^ error: missing match arm |
697 | Either::A(true | false) => (), | 697 | Either::A(true | false) => (), |
698 | } | 698 | } |
699 | } | 699 | } |
@@ -715,7 +715,7 @@ fn main(v: S) { | |||
715 | match v { S{..} => {} } | 715 | match v { S{..} => {} } |
716 | match v { _ => {} } | 716 | match v { _ => {} } |
717 | match v { } | 717 | match v { } |
718 | //^ missing match arm | 718 | //^ error: missing match arm |
719 | } | 719 | } |
720 | "#, | 720 | "#, |
721 | ); | 721 | ); |
@@ -731,7 +731,7 @@ fn main() { | |||
731 | false => {} | 731 | false => {} |
732 | } | 732 | } |
733 | match true { _x @ true => {} } | 733 | match true { _x @ true => {} } |
734 | //^^^^ missing match arm | 734 | //^^^^ error: missing match arm |
735 | } | 735 | } |
736 | "#, | 736 | "#, |
737 | ); | 737 | ); |
@@ -786,12 +786,12 @@ use lib::E; | |||
786 | fn main() { | 786 | fn main() { |
787 | match E::A { _ => {} } | 787 | match E::A { _ => {} } |
788 | match E::A { | 788 | match E::A { |
789 | //^^^^ missing match arm | 789 | //^^^^ error: missing match arm |
790 | E::A => {} | 790 | E::A => {} |
791 | E::B => {} | 791 | E::B => {} |
792 | } | 792 | } |
793 | match E::A { | 793 | match E::A { |
794 | //^^^^ missing match arm | 794 | //^^^^ error: missing match arm |
795 | E::A | E::B => {} | 795 | E::A | E::B => {} |
796 | } | 796 | } |
797 | } | 797 | } |
@@ -810,7 +810,7 @@ fn main() { | |||
810 | false => {} | 810 | false => {} |
811 | } | 811 | } |
812 | match true { | 812 | match true { |
813 | //^^^^ missing match arm | 813 | //^^^^ error: missing match arm |
814 | true if false => {} | 814 | true if false => {} |
815 | false => {} | 815 | false => {} |
816 | } | 816 | } |