-
Notifications
You must be signed in to change notification settings - Fork 77
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
chore(all): Migrate all instances of #[allow]
to #[expect]
#1561
Conversation
It seems like this does not work as expected if msrv is set below 1.81: rust-lang/rust-clippy#13348 Because this change is pervasive and expected to be used in every single crate of ours, can you bump the msrv of all crates to 1.81? We should hopefully see clippy triggering). |
#[expect( | ||
clippy::allow_attributes, | ||
reason = "this allow is conditional and hence necessary" | ||
)] | ||
#[allow( | ||
dead_code, | ||
reason = "unused warning if `bench_include_allocs` feature is not enabled" | ||
)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't you also tuck this under the cfg_attr
below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced with #cfg(feature = "bench_include_allocs")
crates/astria-sequencer-relayer/src/relayer/celestia_client/celestia_keys.rs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment on all the expect
lines that go above a cfg_attr
attribute: I think you should be able to put them under the attribute, something like this:
#[cfg_attr(
feature = "bla",
expect(dead_code, reason = "benchmarks use only some parts of the test code").,
)]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed offline, this unfortunately doesn't work because clippy evaluates the expect
attribute even when the feature is not enabled. Tracking issue here: #1585
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thank you for going through all of those.
I have left a number of comments where I think we should follow up with issues, or where the allow
and/or expect
are so wordy, that we should actually just get rid of them in favor of a simpler fix.
Also, there are a few instances where you had expect
on top of cfg_attr
attributes, which I think could be removed, and instead replacing the value of the cfg_attr
by expect
.
…ner` (#1595) ## Summary Simplified logical statements in `transaction_priority_comparisons_should_be_consistent_nonce_diff()`. ## Background Previously there was an allow for `clippy::nonminimal_bool`. The reasoning behind it was to match documented behavior. This change is meant to explicitly state the expected behavior while still simplifying the boolean expressions. This is in response to this comment: #1561 (comment) ## Changes - Simplified boolean expressions and moved the non-simplified versions to the comments where applicable to provide context on the documented behavior. ## Testing Passing all tests ## Related Issues closes #1583
* main: (34 commits) feat(proto): add bundle and optimistic block apis (#1519) feat(sequencer)!: make empty transactions invalid (#1609) chore(sequencer): simplify boolean expressions in `transaction container` (#1595) refactor(cli): merge argument parsing and command execution (#1568) feat(charts): astrotrek chart (#1513) chore(charts): genesis template to support latest changes (#1594) fix(ci): code freeze action fix (#1610) chore(sequencer)!: exclusively use Borsh encoding for stored data (ENG-768) (#1492) ci: code freeze through github actions (#1588) refactor(sequencer): use builder pattern for transaction container tests (#1592) feat(conductor)!: implement chain ID checks (#1482) chore(ci): upgrade audit-check (#1577) feat(sequencer)!: transaction categories on UnsignedTransaction (#1512) fix(charts): sequencer prometheus rules (#1598) chore(all): Migrate all instances of `#[allow]` to `#[expect]` (#1561) chore(charts,sequencer-faucet): asset precision (#1517) chore(docs): endpoints (#1543) fix(docker): use target binary build param as name of image entrypoint (#1573) fix(ci): ibc bridge test timeout (#1587) Feature: Add `graph-node` to charts. (#1489) ...
Summary
Implemented usage of
#[expect]
instead of#[allow]
following bump to Rust 1.81Background
With the recent bump to Rust 1.81 (#1523), the usage of
#[expect]
is now stable. This is preferable because it warns in case the lint is unfulfilled, keeping us from having superfluous allow attributes.Changes
test.yml
to includeclippy::allow_attributes
andclippy::allow_attributes_with_no_reason
lints#[allow]
to#[expect]
, with the exception of our generated modules.Testing
Passing all tests
Related Issues
closes #1521