Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored take_unwrap (libstd/option.rs) #12931

Merged
merged 1 commit into from
Mar 16, 2014
Merged

Refactored take_unwrap (libstd/option.rs) #12931

merged 1 commit into from
Mar 16, 2014

Conversation

aochagavia
Copy link
Contributor

Using pattern matching instead of is_some + unwrap

Using pattern matching instead of is_some + unwrap
@aochagavia
Copy link
Contributor Author

Why does this happen? It has nothing to do with the refactored function...

failures:

---- [run-fail] run-fail/assert-macro-fmt.rs stdout ----

error: error pattern 'failed at 'test-assert-fmt 42 rust'' not found!
command: x86_64-unknown-linux-gnu/test/run-fail/assert-macro-fmt.stage2-x86_64-unknown-linux-gnu 
stdout:
------------------------------------------

------------------------------------------
stderr:
------------------------------------------
task '<main>
------------------------------------------

task '[run-fail] run-fail/assert-macro-fmt.rs' failed at 'explicit failure', /home/rustbuild/src/rust-buildbot/slave/auto-linux-64-nopt-t/build/src/compiletest/runtest.rs:950

bors added a commit that referenced this pull request Mar 16, 2014
Using pattern matching instead of is_some + unwrap
@bors bors closed this Mar 16, 2014
@bors bors merged commit ea8da6e into rust-lang:master Mar 16, 2014
@aochagavia aochagavia deleted the option-take_unwrap branch May 13, 2014 06:43
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 9, 2022
Add more constructors and entry-APIs for la-arena

`la-arena` on crates.io is quite helpful when just a thin wrapper for Vec with u32 indices is needed.
But the current API is not ergonomic enough.

This PR
- Adds `ArenaMap::new`. Not sure why only `Arena` has it now.
- Adds `Arena{,Map}::with_capacity` for known-size storage.
- Adds entry-API for `ArenaMap` for easier `.entry(idx).or_default().push(value)` or `.entry(idx).or_insert(...)` operations.
lnicola pushed a commit to lnicola/rust that referenced this pull request Aug 9, 2022
More methods and traits for `la_arena::ArenaMap`

Continue of rust-lang#12931. Seems that I forgot some methods in the previous PR :(

I also changed `ArenaMap::insert` to return the old value, to match the map-like collection API of std. **So this is a breaking change.**

r? `@lnicola`
Sign up for free to 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.

2 participants