-
Notifications
You must be signed in to change notification settings - Fork 527
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
Add Map::remove_entry #708
Conversation
Okay so |
IndexMap has a remove method that is the same as swap_remove, so there is no need to use #[cfg] branching for this.
833afc4
to
496ae25
Compare
Which simply calls the same method on the underlying map.
496ae25
to
fad1759
Compare
@dtolnay It's now behind a feature flag that is also tested on CI. Can you take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to do feature stuff for this. It would be better to emulate the API if remove_entry is not directly available on the underlying type. Is that possible?
No, unfortunately I don't think that is possible. The entry API requires taking ownership of the key which defeats the whole point, and a raw entry API is only available for HashMap, not BTreeMap. |
Closing in favor of #712 which emulates the API when remove_entry is not available on the underlying type. |
I see, so using a less efficient implementation on older versions. I like that 👍 |
… and simplify
Map::remove
, since I noticed it uses#[cfg]
branching when it doesn't need to.