]> git.lizzy.rs Git - rust.git/blob - tests/ui/single_match_else.rs
iterate List by value
[rust.git] / tests / ui / single_match_else.rs
1 #![warn(clippy::single_match_else)]
2
3 enum ExprNode {
4     ExprAddrOf,
5     Butterflies,
6     Unicorns,
7 }
8
9 static NODE: ExprNode = ExprNode::Unicorns;
10
11 fn unwrap_addr() -> Option<&'static ExprNode> {
12     match ExprNode::Butterflies {
13         ExprNode::ExprAddrOf => Some(&NODE),
14         _ => {
15             let x = 5;
16             None
17         },
18     }
19 }
20
21 macro_rules! unwrap_addr {
22     ($expression:expr) => {
23         match $expression {
24             ExprNode::ExprAddrOf => Some(&NODE),
25             _ => {
26                 let x = 5;
27                 None
28             },
29         }
30     };
31 }
32
33 fn main() {
34     unwrap_addr!(ExprNode::Unicorns);
35 }