rust/tests/ui/issues/issue-25497.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

20 lines
313 B
Rust
Raw Normal View History

// 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);
}