We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It suggests to use str::split instead of chaining .to_string().split().
str::split
.to_string().split()
str_split_instead_of_to_string_chain
style
shorter, there is no overhead as far as i know https://godbolt.org/z/ET7Y55P4E
No response
fn count_string(s: &str) -> usize { s.to_string().split(",").count() }
Could be written as:
fn count_str(s: &str) -> usize { s.split(",").count() }
The text was updated successfully, but these errors were encountered:
Would be a good enhancement to unnecessary_to_owned
unnecessary_to_owned
Sorry, something went wrong.
Sending a PR shortly to handle this case.
UNNECESSARY_TO_OWNED
split
858d96d
Successfully merging a pull request may close this issue.
What it does
It suggests to use
str::split
instead of chaining.to_string().split()
.Lint Name
str_split_instead_of_to_string_chain
Category
style
Advantage
shorter, there is no overhead as far as i know
https://godbolt.org/z/ET7Y55P4E
Drawbacks
No response
Example
Could be written as:
The text was updated successfully, but these errors were encountered: