mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-22 15:57:46 +02:00
Fix typo in args().next() (#400)
* Fix typo in args().next() Follow up on #367 * Update match-expressions.md
This commit is contained in:
parent
faaf2eacdc
commit
2b1dc9ec66
@ -26,7 +26,7 @@ Rust.
|
|||||||
|
|
||||||
* Save the match expression to a variable and print it out.
|
* Save the match expression to a variable and print it out.
|
||||||
* Remove `.as_deref()` and explain the error.
|
* Remove `.as_deref()` and explain the error.
|
||||||
* `std::env::Agrs().next` returns an `Option<&String>`, but we cannot match against `String`.
|
* `std::env::args().next()` returns an `Option<&String>`, but we cannot match against `String`.
|
||||||
* `as_deref()` transforms an `Option<T>` to `Option<T::Target>`. In our case, this turns `Option<&String>` into `Option<&str>`.
|
* `as_deref()` transforms an `Option<T>` to `Option<T::Target>`. In our case, this turns `Option<&String>` into `Option<&str>`.
|
||||||
* We can now use pattern matching to match against the `&str` inside `Option`.
|
* We can now use pattern matching to match against the `&str` inside `Option`.
|
||||||
</details>
|
</details>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user