]> git.lizzy.rs Git - rust.git/commit - src/tools/miri
Rollup merge of #68918 - brson:unwrapdoc, r=Dylan-DPC
authorDylan DPC <dylan.dpc@gmail.com>
Sat, 8 Feb 2020 23:53:55 +0000 (00:53 +0100)
committerGitHub <noreply@github.com>
Sat, 8 Feb 2020 23:53:55 +0000 (00:53 +0100)
commit2be062a4b08c4d0c108f41c8714f380cb5a05873
tree58d1feb4f913b50b671261452712427c1e7b3ea2
parent664d87f9b1e54421e9fa77988e92be53337821fd
parent8251e12950159c5802dd3995b14be7cf4fa99acd
Rollup merge of #68918 - brson:unwrapdoc, r=Dylan-DPC

Don't use the word "unwrap" to describe "unwrap" methods

It's tautological, and "unwrap" is essentially Rust-specific jargon.

I was teaching a newbie some Rust, and doing the usual hand-waving about error handling using unwrap. They asked what 'unwrap' means. I said look it up in the docs. The docs read (paraphrased) "unwrap unwraps". I was embarrassed.

This changes all the Option/Result functions with unwrapping behavior to use a variation on a single description:

> "Returns the contained `Some/Ok` value [or ...]."

It also renames the closure of `Result::unwrap_or_else` to `default` for consistency with `Option`, and perhaps makes a few other small tweaks.

Previous: https://github.com/rust-lang/rust/pull/68849
src/libcore/option.rs
src/libcore/result.rs