Skip to content

Conversation

zihan0822
Copy link
Contributor

@zihan0822 zihan0822 commented Oct 4, 2025

When matched against Result with copyable Ok variant, uncopyable scrutinee won't actually be moved. But manual_unwrap_or/manual_unwrap_or_default will force it to move, which can cause problem if scrutinee is used later.

Fixes #15807

changelog: [manual_unwrap_or]: don't lint if not safe to move scrutinee
changelog: [manual_unwrap_or_default]: don't lint if not safe to move scrutinee

When matched against `Result` with copyable `Ok` variant, uncopyable scrutinee won't
actually be moved. But `manual_unwrap_or`/`manual_unwrap_or_default`
will force it to move, which can cause problem if scrutinee is used later.

changelog: [`manual_unwrap_or`]: don't lint if not safe to move scrutinee
changelog: [`manual_unwrap_or_default`]: don't lint if not safe to move scrutinee

Signed-off-by: Zihan <zihanli0822@gmail.com>
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 4, 2025

r? @blyxyas

rustbot has assigned @blyxyas.
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

@rustbot
Copy link
Collaborator

rustbot commented Oct 11, 2025

☔ The latest upstream changes (possibly ebbbbeb) made this pull request unmergeable. Please resolve the merge conflicts.

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.

clippy::manual_unwrap_or_default / clippy::manual_unwrap_or suppose unwrapping self, violating trait function signature

3 participants