-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Rename .as_mut() to .as_mut_ref() in Option/Result/AnyMutRefExt #14299
Conversation
For consistency with other naming patterns, rename .as_mut() to .as_mut_ref(). Leave .as_mut() as a deprecated function. [breaking-change]
The reasoning behind naming it |
Every other library method I've looked at that has
|
This may need some more context to take action on it before moving forward. I view I know that @aturon has recently been analyzing our patterns throughout the stdlib, and I know he'd be interested in this. |
I was motivated to do this because I tried to write code and just used The only context where I would be interested to hear what @aturon has to say on this subject. |
There's a clear convention about mutable variants of On the other hand, the Personally, I tend to agree with @kballard: part of the help of conventions is that you (and your finger muscles) don't have to remember special cases, even if that sometimes means typing more. Two other points.
|
@aturon Do you think we should hold off on resolving this local consistency issue until #13660 is resolved? I don't think there's a need to wait on that (especially because, as I commented in #13660, I think having Also, until such time as a decision is made to rename |
@kballard I would not be opposed to resolving this ahead of #13660 if there was clear consensus about it, since the underlying, informal convention is otherwise consistent. OTOH, if there is going to be a debate on this name, it should connect to the wider debate around #13660, which is asking for a formal convention around I also agree about the name change for `&mut T. Just something to keep in mind. As far as I can tell, this is a unique exception to the usual |
Some thoughts that went into the original decision:
They're not very strong arguments in the face of the rest of the standard library, however. I'd also be fine with resolving this ahead of #13660 and the mut/uniq debate. May as well get everything in to line first. |
Closing due to inactivity, but these naming issues with mutability definitely need to be resolved for 1.0! |
fix: Fix search not searching bodies of attributed items Closes rust-lang/rust-analyzer#14229
For consistency with other naming patterns, rename .as_mut() to
.as_mut_ref().
Leave .as_mut() as a deprecated function.
[breaking-change]