rust/compiler/rustc_mir
Yuki Okushi 1c3fea2f8c
Rollup merge of #82849 - camsteffen:option-get-or-default, r=joshtriplett
Add Option::get_or_default

Tracking issue: #82901

The original issue is #55042, which was closed, but for an invalid reason (see discussion there). Opening this to reconsider (I hope that's okay). It seems like the only gap for `Option` being "entry-like".

I ran into a need for this method where I had a `Vec<Option<MyData>>` and wanted to do `vec[n].get_or_default().my_data_method()`. Using an `Option` as an inner component of a data structure is probably where the need for this will normally arise.
2021-03-10 08:01:32 +09:00
..
src Rollup merge of #82849 - camsteffen:option-get-or-default, r=joshtriplett 2021-03-10 08:01:32 +09:00
Cargo.toml bumped smallvec deps 2021-02-14 18:03:11 +03:00