-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
iter_nth_zero lint didn't display 'next' in recommendation #5783
Comments
We only use the rustc interface for diagnostics, so we can't change the truncation on our end. But we could improve the message before the suggestion to: |
that sounds good.. if you could point me at the file where the message is created, I could try to write a patch. |
Thanks, the message is generated here: rust-clippy/clippy_lints/src/methods/mod.rs Line 2352 in 7d611d9
|
thanks, I'm on it |
PR #5793 filed. I wasn't able to run
That might be a transient error (tomorrow's nightly might have rustfmt available), but I was suspicious of the fact that the setup script is using a release named "master", while the Anyways, I only changed a few literal strings, so I doubt I broke anything that |
improve advice in iter_nth_zero fixes #5783 *Please keep the line below* changelog: For iter_nth_zero, the "use .next()" replacement advice is on the last line of the code snippet, where it is vulnerable to truncation. Display that advice at the beginning instead.
I passed the following code to clippy:
It correctly identified that I could replace the
nth(0)
with a simplenext
, but the way it described what I should do was confusing, because it elided the final line:I'm guessing that clippy has to trim lines when the code block is above some size threshold, but in this case the line it trimmed was the critical one; without it the recommendation doesn't make much sense to someone who doesn't remember the low-level Iterator API.
If the
help: try calling ...
output saidhelp: try calling 'next()' instead of 'nth(0)'
, then the recommendation wouldn't depend quite so much upon the code sample.Meta
The text was updated successfully, but these errors were encountered: