Closed
Description
What it does
It checks for str::bytes().count()
and suggests replacing it with str::len()
that does the same but shorter and possibly more performant.
Extra: can something like this be done for https://doc.rust-lang.org/std/io/trait.Read.html#method.bytes too?
Lint Name
bytes_count_to_len
Category
complexity
Advantage
- Might be more performant
- Shorter
- Possibly easier to read
Drawbacks
No response
Example
fn main() {
"hello".bytes().count();
}
Could be written as:
fn main() {
"hello".len();
}