-
Notifications
You must be signed in to change notification settings - Fork 1.6k
unnecessary_join
lint
#8573
New issue
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
unnecessary_join
lint
#8573
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @flip1995 (or someone else) soon. Please see the contribution instructions for more information. |
To get the type of the turbofish inside the Looking at your implementation: You try to get the |
Thank you @flip1995 for the quick and helpful response! Will look into this soon, passing the iterator from Any input on how I would check that Any comment on the validity of the lint itself? I opened the issue recently so I want to make sure that I'm not missing anything that would make this invalid. I'm new to both the clippy codebase and Rust in general so any advice or input would be appreciated! Thanks again! |
For
This lint sounds reasonable to me. I can't really think of when you would want to use |
@flip1995 made some updates and added tests, seems to work correctly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will have to think about the case where directly collecting into a String
might not be possible.
But until then, I left some comments.
I suggest also adding |
The correct command is @rustbot ready |
Thanks @flip1995! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impl looks great!
@flip1995 I think that's everything we discussed, there's the issue of cases where directly collecting into a String might not be possible, but I'm not sure that's still an issue if this is in |
I think it is pretty much impossible to add a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the review so quickly! Please squash (some of) your commits and then we can merge this PR.
Sorry closed by mistake, reopening |
`unnecessary_join` lint changelog: Adds a lint called ``[`unnecessary_join`]`` that detects cases of `.collect::<Vec<String>>.join("")` or `.collect::<Vec<_>>.join("")` on an iterator, suggesting `.collect::<String>()` instead Fixes: #8570 This is a reopen of #8573 changelog: add lint [`unnecessary_join`]
Suppress the `min_ident_chars` warning for items whose name we cannot control. Do not warn for `use a::b`, but warn for `use a::b as c`, since `c` is a local identifier. Fixes rust-lang#8573
changelog: Adds a lint called
[`unnecessary_join`]
that detects cases of.collect::<Vec<String>>.join("")
or.collect::<Vec<_>>.join("")
on an iterator, suggesting.collect::<String>()
insteadFixes: #8570