Skip to content

Fix needless-bool clippy violation - #993

Open
reese wants to merge 1 commit into
trunkfrom
reese-needlees-bool
Open

reese wants to merge 1 commit into
trunkfrom
reese-needlees-bool

Conversation

@reese

@reese reese commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

On rust nightly/beta, this is now a clippy violation, so I figured I'd just preemptively fix it

error: this `if` guard returns a bool literal and is followed by another
    --> librubyfmt/src/format_prism.rs:1833:5
     |
1833 | /     if context == FormattingContext::ClassOrModule && !original_used_parens {
1834 | |         return false;
...    |
1837 | |     true
     | |________^ help: you can reduce it to: `!(context == FormattingContext::ClassOrModule && !original_used_parens)`
     |
     = help: for further information visit https://clippy.rust-lang.org/main/index.html#needless_bool
note: the lint level is defined here
    --> librubyfmt/src/lib.rs:1:9
     |
   1 | #![deny(warnings, missing_copy_implementations)]
     |         ^^^^^^^^
     = note: `#[deny(clippy::needless_bool)]` implied by `#[deny(warnings)]`

(The suggestion was !(context == FormattingContext::ClassOrModule && !original_used_parens), but that was a double-negative so I made it context != FormattingContext::ClassOrModule || original_used_parens instead.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant