-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
attributes: suppress
clippy::suspicious_else
without nop let (#1614)
Currently, `tracing-attributes` generates a `let _ = ();` in between the `if tracing::level_enabled!(...) {}` and the function body. This is intended to suppress the `clippy::suspicious_else_formatting` lint, which is generated when an `if` is followed immediately by a block with no whitespace in between. Since we can't add whitespace in the generated code (as `quote` produces a stream of _rust tokens_, not text), we can't suppress the lint without adding a no-op statement. However, unfortunately, the no-op let triggers a _different_ lint (`clippy::let_unit_value`), when `clippy::pedantic` is enabled. This is kind of annoying for some users. This branch changes the code to suppress the `suspicious_else_formatting` lint using `#[allow(...)]` attributes, instead. The warning is turned back on inside of user code, since users probably want the warning.
- Loading branch information
Showing
3 changed files
with
20 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters