Change to avoid repeated "is"
This commit is contained in:
parent
5122a6d936
commit
5a15144b95
@ -279,11 +279,11 @@ fn extension(file_name: &str) -> Option<&str> {
|
||||
}
|
||||
```
|
||||
|
||||
One other pattern that we find it very common is assigning a default value to
|
||||
the case when an `Option` value is `None`. For example, maybe your program
|
||||
assumes that the extension of a file is `rs` even if none is present. As you
|
||||
might imagine, the case analysis for this is not specific to file
|
||||
extensions - it can work with any `Option<T>`:
|
||||
One other pattern we commonly find is assigning a default value to the case
|
||||
when an `Option` value is `None`. For example, maybe your program assumes that
|
||||
the extension of a file is `rs` even if none is present. As you might imagine,
|
||||
the case analysis for this is not specific to file extensions - it can work
|
||||
with any `Option<T>`:
|
||||
|
||||
```rust
|
||||
fn unwrap_or<T>(option: Option<T>, default: T) -> T {
|
||||
|
Loading…
x
Reference in New Issue
Block a user