Skip to content

Commit

Permalink
Minor corrections
Browse files Browse the repository at this point in the history
Irrefutable pattern receives warning, refutable error, when used unexpectedly.
  • Loading branch information
deep-outcome committed Oct 8, 2022
1 parent f1e5ad8 commit 09db1e5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ch18-02-refutability.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ the code in the curly brackets, giving it a way to continue validly. Listing
patterns instead of `let`</span>

We’ve given the code an out! This code is perfectly valid, although it means we
cannot use an irrefutable pattern without receiving an error. If we give `if
cannot use an irrefutable pattern without receiving a warning. If we give `if
let` a pattern that will always match, such as `x`, as shown in Listing 18-10,
the compiler will give a warning.

Expand All @@ -83,7 +83,7 @@ For this reason, match arms must use refutable patterns, except for the last
arm, which should match any remaining values with an irrefutable pattern. Rust
allows us to use an irrefutable pattern in a `match` with only one arm, but
this syntax isn’t particularly useful and could be replaced with a simpler
`let` statement.
`if let` statement.

Now that you know where to use patterns and the difference between refutable
and irrefutable patterns, let’s cover all the syntax we can use to create
Expand Down

0 comments on commit 09db1e5

Please sign in to comment.