Skip to content

Lints cleanups#160

Open
nbdd0121 wants to merge 4 commits into
mainfrom
dev/lint
Open

Lints cleanups#160
nbdd0121 wants to merge 4 commits into
mainfrom
dev/lint

Conversation

@nbdd0121

Copy link
Copy Markdown
Member

Clean up allow and expects inside pin-init.

nbdd0121 added 4 commits July 10, 2026 17:13
Remove the drop and associated clippy allow. The warning reported by Clippy
here is genuine; the binding created is `Pin<&mut T>` so dropping it does
nothing. `stack_pin_init` created bindings are only dropped at the end of
scope.

Signed-off-by: Gary Guo <gary@garyguo.net>
These lints are automatically suppressed inside doc tests. Previously this
is needed because kernel builds doc tests with the default set of clippy
flags; but now `clippy::disallowed_names` is globally allowed inside doc
tests.

Signed-off-by: Gary Guo <gary@garyguo.net>
Most warnings are suppressed from external macro expansions by default, and
`unfulfilled_lint_expectations` is one of them. All of our `expect`s inside
macros therefore do nothing, and actually mislead people to the lints would
be actually emitted without them.

All `#[expect]`s on lints that do not fire inside external macros (and
without spans from users) are removed, while the rest is coverted to
`#[allow]`.

Signed-off-by: Gary Guo <gary@garyguo.net>
`init!` support interleaving code execution and initialization, and code
execution is done using `_: { ... }` syntax. If the code inside block is a
single statement, Rust may add a lint about unused braces, but the
suggestion will be incorrect as block is required by pin-init.

Currently we use `unused_brace` to suppress this, but this affect
everything nested inside as well. Use an alternative approach by generating
the block from the macro, then rustc will know to not emit the lint.

Signed-off-by: Gary Guo <gary@garyguo.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant