Suggest len
instead of count
on arrays, slices, or vectors
#87302
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
D-newcomer-roadblock
Diagnostics: Confusing error or lint; hard to understand for new users.
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=8bd1115b12adc0eb5feb16bbb63a06cb
The current output is:
(repeated 3 times with slight variations)
Ideally the output should:
slice.len()
instead ofslice.count()
This is a common error, particularly for new users, and when switching between iterators and vectors/slices/arrays.
The text was updated successfully, but these errors were encountered: