-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Closed
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
(moved from rust-lang/rust-analyzer#6626)
With the following code:
fn f(vec: &Vec<usize>) {
vec.push(5);
}I get a suggestion to "change this to a mutable reference", but if I do, I get:
fn f(vec: &mut std::vec::Vec<usize>) {
vec.push(5);
}That's a bit overkill, right? I would rather expect
fn f(vec: &mut Vec<usize>) {
vec.push(5);
}It actually becomes worse. I've decided to file this bug report after my argument:
shells: &LocatedShells,was changed to
shells: &mut topology::located_slice::LocatedBoxedSlice<std::collections::HashMap<usize, shell::Shell, std::hash::BuildHasherDefault<fnv::FnvHasher>>>,instead of just
shells: &mut LocatedShells,That's definitely overkill, so I end up changing the & to &mut by hand.
Is this something expected? Or something I can configure not to happen?
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.