Skip to content

Commit

Permalink
Minor change
Browse files Browse the repository at this point in the history
  • Loading branch information
simsekgokhan committed Dec 23, 2023
1 parent 83542a8 commit 704d269
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/match_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ struct Point { x: i32, y: i32 }
#[test] fn ex_4_a() {
let p = Point { x: 0, y: 7 };
let Point { x: a, y: b } = p;
assert_eq!(0, a);
assert_eq!(7, b);
assert_eq!(a, 0);
assert_eq!(b, 7);
// or simpler
let Point { x, y } = p;
assert_eq!(x, 0);
assert_eq!(y, 7);

match p {
Point { x, y: 0 } => println!("x is any, y is 0"),
Expand Down

0 comments on commit 704d269

Please sign in to comment.