Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code example for Option::unwrap_or_default #102283

Merged

Conversation

GuillaumeGomez
Copy link
Member

Fixes #100054.
Follow-up of #102259.

r? @thomcc

@GuillaumeGomez GuillaumeGomez added the A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools label Sep 25, 2022
@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label Sep 25, 2022
@rustbot
Copy link
Collaborator

rustbot commented Sep 25, 2022

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 Sep 25, 2022
@thomcc
Copy link
Member

thomcc commented Sep 25, 2022

LGTM, thanks.

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 25, 2022

📌 Commit 816a9a9ed96c665d01d74357da2e4058297ed50b has been approved by thomcc

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-review Status: Awaiting review from the assignee but also interested parties. labels Sep 25, 2022
@vacuus
Copy link
Contributor

vacuus commented Sep 25, 2022

Within the Examples section that the code is in, the text should be removed (it's from the previous example with parse).

@thomcc
Copy link
Member

thomcc commented Sep 25, 2022

Nice catch. Mind fixing?

@bors r-
@rustbot author

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

This comment has been minimized.

@GuillaumeGomez GuillaumeGomez force-pushed the option-code-example-unwrap-or-default branch from 816a9a9 to 475aeab Compare September 26, 2022 10:38
@GuillaumeGomez
Copy link
Member Author

I removed the text too now (and also fixed the assert which I badly wrote previously by using 12 instead of y).

@thomcc
Copy link
Member

thomcc commented Sep 26, 2022

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Sep 26, 2022

📌 Commit 475aeab has been approved by thomcc

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 26, 2022
notriddle added a commit to notriddle/rust that referenced this pull request Sep 26, 2022
…-unwrap-or-default, r=thomcc

Improve code example for Option::unwrap_or_default

Fixes rust-lang#100054.
Follow-up of rust-lang#102259.

r? `@thomcc`
notriddle added a commit to notriddle/rust that referenced this pull request Sep 26, 2022
…-unwrap-or-default, r=thomcc

Improve code example for Option::unwrap_or_default

Fixes rust-lang#100054.
Follow-up of rust-lang#102259.

r? ``@thomcc``
@bors
Copy link
Contributor

bors commented Sep 26, 2022

⌛ Testing commit 475aeab with merge f3a6fbf...

@bors
Copy link
Contributor

bors commented Sep 27, 2022

☀️ Test successful - checks-actions
Approved by: thomcc
Pushing f3a6fbf to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 27, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Sep 27, 2022
Rollup of 6 pull requests

Successful merges:

 - rust-lang#102283 (Improve code example for Option::unwrap_or_default)
 - rust-lang#102319 (rustdoc: merge CSS `table` rules into `.docblock`)
 - rust-lang#102321 ( Rustdoc-Json: List impls for primitives)
 - rust-lang#102322 (Document that Display automatically implements ToString)
 - rust-lang#102325 (rustdoc: give `.line-number` / `.line-numbers` meaningful names)
 - rust-lang#102326 (rustdoc: Update doc comment for splitn_mut to include mutable in the …)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f3a6fbf into rust-lang:master Sep 27, 2022
@rustbot rustbot added this to the 1.66.0 milestone Sep 27, 2022
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (f3a6fbf): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean1 range count2
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-0.7%, -0.7%] 1
Improvements ✅
(secondary)
-1.3% [-1.6%, -1.2%] 6
All ❌✅ (primary) -0.7% [-0.7%, -0.7%] 1

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.0% [4.0%, 4.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Cycles

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)
3.7% [2.8%, 4.8%] 3
Improvements ✅
(primary)
-2.3% [-2.7%, -1.9%] 2
Improvements ✅
(secondary)
-2.4% [-2.6%, -2.2%] 2
All ❌✅ (primary) -2.3% [-2.7%, -1.9%] 2

Footnotes

  1. the arithmetic mean of the percent change 2 3

  2. number of relevant changes 2 3

@GuillaumeGomez GuillaumeGomez deleted the option-code-example-unwrap-or-default branch September 27, 2022 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools 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.

Inaccuracy in the documentation for Option::unwrap_or_default
8 participants