Skip to content

Commit

Permalink
Remove unnecessary block in awkward match
Browse files Browse the repository at this point in the history
  • Loading branch information
gepbird committed Jul 5, 2023
1 parent 5b1e946 commit 7442728
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/flow_control/if_let.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ For some use cases, when matching enums, `match` is awkward. For example:
let optional = Some(7);

match optional {
Some(i) => {
println!("This is a really long string and `{:?}`", i);
// ^ Needed 2 indentations just so we could destructure
// `i` from the option.
},
Some(i) => println!("This is a really long string and `{:?}`", i),
_ => {},
// ^ Required because `match` is exhaustive. Doesn't it seem
// like wasted space?
Expand Down

0 comments on commit 7442728

Please sign in to comment.