Skip to content

improvements to option module - #4465

Merged
catamorphism merged 4 commits into
rust-lang:incomingfrom
thestinger:option
Jan 13, 2013
Merged

improvements to option module#4465
catamorphism merged 4 commits into
rust-lang:incomingfrom
thestinger:option

Conversation

@thestinger

Copy link
Copy Markdown
Contributor

I didn't add an equivalent free function for map_consume_default, mutate and mutate_default because as far as I can tell the only purpose of the free function versions is backwards compatibility.

The mutate methods are based on a need I have in my balanced tree implementation, which arises from doing it entirely without Copy/Clone. It factors out variations of the following pattern which occurs many times:

if foo.inner_option.is_some() {
let inner = swap_unwrap(&mut foo.inner_option);
inner = transform(inner);
foo.inner_option = Some(inner);
}

catamorphism added a commit that referenced this pull request Jan 13, 2013
@catamorphism
catamorphism merged commit 7eae397 into rust-lang:incomingJan 13, 2013
@catamorphism

Copy link
Copy Markdown
Contributor

Thanks!

@thestinger
thestinger deleted the option branch January 14, 2013 06:29
RalfJung added a commit to RalfJung/rust that referenced this pull request Jul 16, 2025
Muscraft pushed a commit to Muscraft/rust that referenced this pull request Jul 21, 2025
U007D pushed a commit to U007D/rust-mos that referenced this pull request Aug 21, 2026
4497: Create LowerCtx on the fly r=matklad a=edwin0cheng
Previously we create `LowerCtx` at the beginning of lowering, however, the hygiene content is in fact changing between macro expression expanding. This PR change it to create the `LowerCtx` on the fly to fix above bug.
However, rust-lang#4465 is not fixed by this PR, the goto-def is still not work yet. It only fixed the infer part. Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@thestinger@catamorphism@findow