Skip to content

Conversation

BenjaminBrienen
Copy link
Contributor

@BenjaminBrienen BenjaminBrienen commented Aug 16, 2025

The advice in the style guide conflicts with a clippy lint.
Also, the "bad" style is consistently used throughout the repository, especially when comparing an index to a length.

warning: this boolean expression can be simplified
   --> crates/hir-def/src/expr_store/lower/asm.rs:244:44
    |
244 | ...                   if !(idx < operands.len())
    |                          ^^^^^^^^^^^^^^^^^^^^^^^ help: try: `(idx >= operands.len())`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
    = note: `-W clippy::nonminimal-bool` implied by `-W clippy::complexity`
    = help: to override `-W clippy::complexity` add `#[allow(clippy::nonminimal_bool)]`

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 16, 2025
@fee1-dead
Copy link
Member

I'm not sure if this is an improvement, because clippy lints are meant to be annoying (cause, clippy) lints that you can choose to follow or ignore.

But it's probably clearer to cite specific instances of both styles used in this repository so we can get a better picture?

@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Aug 25, 2025

The "suggested" style is simply not used in the repo except in some obscure test data.
image

edit: !\(.* [<>+=]+ .*\) yields 12 actual code results, of which, only a few are "true" matches

image

@BenjaminBrienen
Copy link
Contributor Author

BenjaminBrienen commented Aug 25, 2025

\b[a-z_.()0-9]* (<=|>=)+ \S*\b yields 236 results that seem like relevant examples at a glance
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants