Skip to content

Conversation

cathaysia
Copy link

Add Option::clear. This makes Option more like a container.

Although this can also be achieved by using let _ = Option::take(), considering that Option provides insert method (somewhat similar to a container), it seems reasonable to add a clear method to it.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 22, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 22, 2025

r? @scottmcm

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

@rust-log-analyzer

This comment has been minimized.

Signed-off-by: loongtao.zhang <loongtao.zhang@outlook.com>
@cathaysia cathaysia force-pushed the cathaysia/option_clear branch from 73fc26b to c3f2717 Compare October 22, 2025 13:09
@rust-log-analyzer
Copy link
Collaborator

The job x86_64-gnu-gcc failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

For more information how to resolve CI failures of this job, visit this link.

@scottmcm scottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 22, 2025
@scottmcm
Copy link
Member

If you'd like to add a new method, please file an ACP to get libs-api's initial feedback on whether it should exist.

Note that _ = x.take(); is a pretty weird way to phrase this -- I'd expect just x = None;.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants