Skip to content

Commit

Permalink
Fix match in union example.
Browse files Browse the repository at this point in the history
I think the intent here is to match on the variant. The current example is
binding variables named "I" and "F".
  • Loading branch information
ehuss committed Sep 26, 2019
1 parent 6cf18ff commit ec346e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/items/unions.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ struct Value {
fn is_zero(v: Value) -> bool {
unsafe {
match v {
Value { tag: I, u: U { i: 0 } } => true,
Value { tag: F, u: U { f: num } } if num == 0.0 => true,
Value { tag: Tag::I, u: U { i: 0 } } => true,
Value { tag: Tag::F, u: U { f: num } } if num == 0.0 => true,
_ => false,
}
}
Expand Down

0 comments on commit ec346e4

Please sign in to comment.