summaryrefslogtreecommitdiffstats
path: root/src/test/ui/issues/issue-25497.rs
blob: 25f5ab90f7fd3ea6a5898eb03348fa295498bcf5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// run-pass
#[derive(Clone, Debug, PartialEq)]
enum Expression {
    Dummy,
    Add(Box<Expression>),
}

use Expression::*;

fn simplify(exp: Expression) -> Expression {
    match exp {
        Add(n) => *n.clone(),
        _ => Dummy
    }
}

fn main() {
    assert_eq!(simplify(Add(Box::new(Dummy))), Dummy);
}