Skip to content

Change is_some_and to take by value#98354

Merged
bors merged 2 commits into
rust-lang:masterfrom
camsteffen:is-some-and-by-value
Oct 2, 2022
Merged

Change is_some_and to take by value#98354
bors merged 2 commits into
rust-lang:masterfrom
camsteffen:is-some-and-by-value

Conversation

@camsteffen

Copy link
Copy Markdown
Contributor

Consistent with other function-accepting Option methods.

Tracking issue: #93050

r? @m-ou-se

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Jun 21, 2022
@rust-highfive

Copy link
Copy Markdown
Contributor

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 21, 2022
@Xiretza

Xiretza commented Jun 21, 2022

Copy link
Copy Markdown
Contributor

Option::is_some and Option::is_none take &self. I'd say this function is more similar to those than, say, unwrap_or_else(), which actually gives you the value contained in the option.

@m-ou-se

m-ou-se commented Jun 21, 2022

Copy link
Copy Markdown
Member

This seems like a discusssion to have on the tracking issue and get consensus on first.

(I personally think it'd be confusing if an is_ method would consume the Option, and we should be consistent with is_some.)

@m-ou-se m-ou-se closed this Jun 21, 2022
@camsteffen

camsteffen commented Jul 28, 2022

Copy link
Copy Markdown
Contributor Author

Reopening per #99087 (comment). I need to change is_ok_and,is_err_and too.

@camsteffen camsteffen reopened this Jul 28, 2022
@camsteffen camsteffen force-pushed the is-some-and-by-value branch from dc6f6e3 to 81ad37c Compare July 28, 2022 22:16
@rustbot

rustbot commented Jul 28, 2022

Copy link
Copy Markdown
Collaborator

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

@camsteffen

Copy link
Copy Markdown
Contributor Author

Also changed the feature name. Not sure if that is wanted.

@bors

bors commented Aug 22, 2022

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #99702) made this pull request unmergeable. Please resolve the merge conflicts.

@m-ou-se m-ou-se left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! r=me after rebasing.

@m-ou-se m-ou-se 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 Sep 27, 2022
@camsteffen

Copy link
Copy Markdown
Contributor Author

@bors r=m-ou-se

@bors

bors commented Sep 28, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit d88463b363684fdff191a19355ebe108e20500f4 has been approved by m-ou-se

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 28, 2022
@rustbot

rustbot commented Sep 28, 2022

Copy link
Copy Markdown
Collaborator

The Miri subtree was changed

cc @rust-lang/miri

@camsteffen

Copy link
Copy Markdown
Contributor Author

@bors r=m-ou-se

@bors

bors commented Sep 28, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 596176dd74dce4c5d43155c09fcfa81be118dce8 has been approved by m-ou-se

It is now in the queue for this repository.

@bors

bors commented Sep 29, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 596176dd74dce4c5d43155c09fcfa81be118dce8 with merge 9feea309bae62e17e247b52e80b3c32f90c19891...

@bors

bors commented Sep 29, 2022

Copy link
Copy Markdown
Collaborator

💔 Test failed - checks-actions

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 29, 2022
@camsteffen

Copy link
Copy Markdown
Contributor Author

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 29, 2022
@rust-log-analyzer

This comment has been minimized.

@camsteffen camsteffen force-pushed the is-some-and-by-value branch from 65bb1e2 to 4f12de0 Compare October 1, 2022 16:46
@camsteffen

Copy link
Copy Markdown
Contributor Author

@bors r=m-ou-se

@bors

bors commented Oct 1, 2022

Copy link
Copy Markdown
Collaborator

📌 Commit 4f12de0 has been approved by m-ou-se

It is now in the queue for this repository.

@bors

bors commented Oct 2, 2022

Copy link
Copy Markdown
Collaborator

⌛ Testing commit 4f12de0 with merge 91931ec...

@bors

bors commented Oct 2, 2022

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: m-ou-se
Pushing 91931ec to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 2, 2022
@bors bors merged commit 91931ec into rust-lang:master Oct 2, 2022
@rustbot rustbot added this to the 1.66.0 milestone Oct 2, 2022
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (91931ec): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.2% [3.4%, 5.1%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-9.0%, -3.0%] 4
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Footnotes

  1. the arithmetic mean of the percent change

  2. number of relevant changes

@camsteffen camsteffen deleted the is-some-and-by-value branch October 2, 2022 21:28
Aaron1011 pushed a commit to Aaron1011/rust that referenced this pull request Jan 6, 2023
…ou-se

Change `is_some_and` to take by value

Consistent with other function-accepting `Option` methods.

Tracking issue: rust-lang#93050

r? `@m-ou-se`
@Natural-selection1

Natural-selection1 commented Apr 23, 2025

Copy link
Copy Markdown
Contributor

@camsteffen Hello, I'd like to know why the query function is designed to be passed by value?

(Ignore this one because I already found the answer at #93050

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

Labels

merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

9 participants