Skip to content
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

Do not lint write_with_newline when there is more than one newline #2990

Closed
dtolnay opened this issue Aug 2, 2018 · 4 comments · Fixed by #3014
Closed

Do not lint write_with_newline when there is more than one newline #2990

dtolnay opened this issue Aug 2, 2018 · 4 comments · Fixed by #3014
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-false-positive Issue: The lint was triggered on code it shouldn't have

Comments

@dtolnay
Copy link
Member

dtolnay commented Aug 2, 2018

My code uses:

write!(file, "// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT\n\n")?;

I believe the above is clearer than Clippy's suggestion, in which one newline is written by the macro and one newline is written by my string:

writeln!(file, "// THIS FILE IS AUTOMATICALLY GENERATED; DO NOT EDIT\n")?;

Mentioning @estk who worked on this lint in #2630.

@estk
Copy link
Contributor

estk commented Aug 2, 2018

This makes sense to me, @oli-obk?

@ghost
Copy link

ghost commented Aug 3, 2018

#2295 is similar.

@oli-obk
Copy link
Contributor

oli-obk commented Aug 3, 2018

@estk yea, let's not lint on multiple trailing newlines, only on a single one

@estk
Copy link
Contributor

estk commented Aug 3, 2018

I think ill have time to knock this one out within a week.

@phansch phansch added the C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages label Aug 5, 2018
@rustbot rustbot added the I-false-positive Issue: The lint was triggered on code it shouldn't have label Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Enhancement of lints, like adding more cases or adding help messages I-false-positive Issue: The lint was triggered on code it shouldn't have
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants