Skip to content

Conversation

@samueltardieu
Copy link
Member

There is a proposal to change the behaviour of rustc's must_use lint to consider Result<T, U> and ControlFlow<U, T> as T when U is uninhabited. See rust-lang/rust#148214.

This might make the user adding extra #[must_use] attributes to functions returning Result<T, !> or ControlFlow<!, T>, which would trigger the double_must_use lint in Clippy without the current change.

changelog: [double_muse_use, drop_non_drop, let_underscore_must_use]: consider Result<T, U> and ControlFlow<U, T> as T wrt the #[must_use] attribute if U is uninhabited.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jan 7, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 7, 2026

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

No changes for 3ed43d8

There is a proposal to change the behaviour of rustc's `must_use` lint
to consider `Result<T, U>` and `ControlFlow<U, T>` as `T` when `U` is
uninhabited. See <rust-lang/rust#148214>.

This might make the user adding extra `#[must_use]` attributes to
functions returning `Result<T, !>` or `ControlFlow<!, T>`, which would
trigger the `double_must_use` lint in Clippy without the current change.
@samueltardieu
Copy link
Member Author

samueltardieu commented Jan 7, 2026

The second push was made to prevent suggesting using #[must_use] on types that are already #[must_use] even though they will be treated otherwise by rustc in the future (this is the key part). This was detected by lint check on the first iteration.

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