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
Detect uses of print (instead of write) and similar inside of implementations of formatting traits (Debug, Display, LowerHex, etc.)
print
write
What is the advantage of the recommended code over the original code
Using print will appear to work correctly until one tries to print somewhere other than stdout (a file, string buffer, ...)
None.
impl fmt::Display for Test { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { println!("Hello"); writeln!(f, "there!") } }
Should be written as:
impl fmt::Display for Test { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { writeln!(f, "Hello")?; writeln!(f, "there!") } }
The text was updated successfully, but these errors were encountered:
@rustbot label +A-lint
Sorry, something went wrong.
@rustbot claim
@NieDzejkob (cc: @xFrednet ) This may already be implemented.
ref:
print_in_format_impl
Please tell me if I'm incorrect.
The lint looked familiar. Guess this was a duplicate issue. Thank you for pointing that out @unvalley! 🙃
unvalley
No branches or pull requests
What it does
Detect uses of
print
(instead ofwrite
) and similar inside of implementations of formatting traits (Debug, Display, LowerHex, etc.)Categories (optional)
What is the advantage of the recommended code over the original code
Using print will appear to work correctly until one tries to print somewhere other than stdout (a file, string buffer, ...)
Drawbacks
None.
Example
Should be written as:
The text was updated successfully, but these errors were encountered: