-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed as duplicate of#145015
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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
Code
use std::collections::HashMap
pub fn main() {
let a = HashMap::new();
for v in a.mut_values() {
();
}
}
Current output
help: there is a method `values` with a similar name
|
5 - for v in a.mut_values() {
5 + for v in a.values() {
Desired output
help: there is a method `values` with a similar name
|
5 - for v in a.mut_values() {
5 + for v in a.values() {
help: there is a method `values_mut` with a similar name
|
5 - for v in a.mut_values() {
5 + for v in a.values_mut() {
Rationale and extra context
calling a method mut_foo
when foo_mut
exists seems like a fairly obvious attempt to get at the latter, and also a mistake i can imagine other people making
Other cases
Rust Version
rustc 1.87.0 (17067e9ac 2025-05-09)
binary: rustc
commit-hash: 17067e9ac6d7ecb70e50f92c1944e545188d2359
commit-date: 2025-05-09
host: x86_64-unknown-linux-gnu
release: 1.87.0
LLVM version: 20.1.1
Anything else?
No response
Scripter17
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsT-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.