-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-result-optionArea: Result and Option combinatorsArea: Result and Option combinatorsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.
Description
This is a tracking issue for the feature "option_insert".
The feature gate for the issue is #[unstable(feature = "option_insert")]
.
This feature adds a insert
method to any Option
, setting its value and returning a mutable reference to this value.
This method removes a cause of unwrap
and code complexity.
It allows replacing
option_value = Some(build());
option_value.as_mut().unwrap()
with
option_value.insert(build())
Steps / History
- Implementation: add
insert
toOption
#77392 - Decide on a name. Suggestions:
insert
(As in the original PR.)insert_and_get
replace
replace_and_get
set
- ...
- FCP
- Stabilization PR: Stabilize option_insert. #84088
coolreader18 and proudmuslim-dev
Metadata
Metadata
Assignees
Labels
A-result-optionArea: Result and Option combinatorsArea: Result and Option combinatorsC-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCLibs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.The final comment period is finished for this PR / Issue.