You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Warns about calling str::trim (and variants) before str::split_whitespace (and variants). split_whitespace already ignores leading and trailing whitespace.
These two lines produce the same output:
println!("{:?}"," A B C ".trim().split_whitespace().collect::<Vec<_>>());println!("{:?}"," A B C ".split_whitespace().collect::<Vec<_>>());
What it does
Warns about calling
str::trim
(and variants) beforestr::split_whitespace
(and variants).split_whitespace
already ignores leading and trailing whitespace.These two lines produce the same output:
which is
playground
Lint Name
trim_split_whitespace
Category
pedantic
Advantage
trim
call is needlesssplit_whitespace
works this wayDrawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: