Skip to content

Add the find_mut_equiv() method to std::hashmap. #11074

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

Closed
wants to merge 1 commit into from

Conversation

rcatolino
Copy link
Contributor

Add a variant to find_equiv(), returning a mutable ref.
cc @thestinger

@alexcrichton
Copy link
Member

I would like to discuss this before merging. In my opinion, we should fall in one of these three buckets:

  1. Purge *_equiv and figure out a better way of not allocating when looking up in maps with keys of ~str
  2. Remove everything except find_equiv
  3. Make *_equiv variants of all functions.

I am most in favor of 1, but I currently do not know of a way to do that, and failing that I would favor 2 over 3. This warrants more discussion though.

@rcatolino
Copy link
Contributor Author

I was actually wondering why not all the methods were using the equiv trait.

  • The equiv variants can do the work of the non equiv ones, and more (with no performance penalty that I can see).
  • It's a pretty nice way to deal with &'lifetime str/~str. keys IMO, and most of the work seems to be already done (which is always nice)

So I'm in favor of 2. Why would you prefer to purge them ?

@alexcrichton
Copy link
Member

Oh when I said "purge" I didn't mean remove the functionality entirely, but rather remove this _equiv/not equiv duality and just figure out a better way to do it that doesn't involve duplicating all functions. That being said, it's more of an idea than a concrete suggestion, so I don't think it's too useful right now.

@alexcrichton
Copy link
Member

Closing due to inactivity, but feel free to reopen with a rebase!

flip1995 pushed a commit to flip1995/rust that referenced this pull request Sep 7, 2023
…=llogiq

Add config flag for reborrows in explicit_iter_loop

This PR adds a config flag for enforcing explicit into iter lint for reborrowed values. The config flag, `enforce_iter_loop_reborrow`, can be added to clippy.toml files to enable the linting behaviour. By default the reborrow lint is disabled.

fixes: rust-lang#11074

changelog: [`explicit_iter_loop`]: add config flag `enforce_iter_loop_reborrow` to disable reborrow linting by default
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