Get `&mut Map` back from entry API
Rust Internals [Unofficial]
February 13, 2026
Doesn't a simple if let else cover this?
let a_or_b = if let a @ Some(_) = map.get_mut("a") {
a
} else {
map.get_mut("b")
};
play.rust-lang.org
Rust Playground
A browser interface to the Rust compiler to experiment with the language
A method like Entry::or_get(alternative_key) for expressing this succinctly in cases where you are already using the Entry API would be nice to have, that's for sure.
Discussion in the ATmosphere