Skip to content

Commit b49027d

Browse files
committed
Split up some single_match UI tests
As part of rust-lang#2038
1 parent 62d595b commit b49027d

File tree

4 files changed

+309
-313
lines changed

4 files changed

+309
-313
lines changed

tests/ui/matches.rs

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
#![allow(unused, if_let_redundant_pattern_matching)]
77
#![warn(single_match_else, match_same_arms)]
88

9-
use std::borrow::Cow;
10-
11-
enum Foo { Bar, Baz(u8) }
12-
use Foo::*;
13-
149
enum ExprNode {
1510
ExprAddrOf,
1611
Butterflies,
@@ -29,67 +24,6 @@ fn unwrap_addr() -> Option<&'static ExprNode> {
2924
}
3025
}
3126

32-
fn single_match(){
33-
let x = Some(1u8);
34-
35-
match x {
36-
Some(y) => { println!("{:?}", y); }
37-
_ => ()
38-
};
39-
40-
let z = (1u8,1u8);
41-
match z {
42-
(2...3, 7...9) => dummy(),
43-
_ => {}
44-
};
45-
46-
// Not linted (pattern guards used)
47-
match x {
48-
Some(y) if y == 0 => println!("{:?}", y),
49-
_ => ()
50-
}
51-
52-
// Not linted (no block with statements in the single arm)
53-
match z {
54-
(2...3, 7...9) => println!("{:?}", z),
55-
_ => println!("nope"),
56-
}
57-
}
58-
59-
fn single_match_know_enum() {
60-
let x = Some(1u8);
61-
let y : Result<_, i8> = Ok(1i8);
62-
63-
match x {
64-
Some(y) => dummy(),
65-
None => ()
66-
};
67-
68-
match y {
69-
Ok(y) => dummy(),
70-
Err(..) => ()
71-
};
72-
73-
let c = Cow::Borrowed("");
74-
75-
match c {
76-
Cow::Borrowed(..) => dummy(),
77-
Cow::Owned(..) => (),
78-
};
79-
80-
let z = Foo::Bar;
81-
// no warning
82-
match z {
83-
Bar => println!("42"),
84-
Baz(_) => (),
85-
}
86-
87-
match z {
88-
Baz(_) => println!("42"),
89-
Bar => (),
90-
}
91-
}
92-
9327
fn match_bool() {
9428
let test: bool = true;
9529

0 commit comments

Comments
 (0)