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

@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

This comment has been minimized.

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 <[email protected]>
@zihan0822 zihan0822 force-pushed the fix-manual-unwrap-or-default-fp branch from aff6178 to d449806 Compare October 16, 2025 03:47
@rustbot
Copy link
Collaborator

rustbot commented Oct 16, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@blyxyas
Copy link
Member

blyxyas commented Oct 28, 2025

I currently can't handle any reviews, sorry for the delay. I'll re-rotate and another team member will take this one.
r? clippy

@rustbot
Copy link
Collaborator

rustbot commented Oct 28, 2025

Error: assign handler unexpectedly failed in this comment: error decoding response body

Please file an issue on GitHub at triagebot if there's a problem with this bot, or reach out on #triagebot on Zulip.

@blyxyas
Copy link
Member

blyxyas commented Oct 29, 2025

r? clippy
It should be fixed now

@rustbot rustbot assigned flip1995 and unassigned blyxyas Oct 29, 2025
Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@flip1995 flip1995 added this pull request to the merge queue Oct 29, 2025
Merged via the queue into rust-lang:master with commit 35e55a6 Oct 29, 2025
11 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

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

4 participants