Skip to content

Conversation

samueltardieu
Copy link
Member

@samueltardieu samueltardieu commented Sep 18, 2025

.unwrap_or(vec![]) is as readable as .unwrap_or_default().

Also, this ensures by adding tests that expressions such as .unwrap_or(DEFAULT_LITERAL) (0, "", etc.) are not replaced by .unwrap_or_default() either.

Related to the discussion in the Zulip discussion about PR #15037.

changelog: [unwrap_or_default]: do not replace .unwrap_or(vec![]) by .unwrap_or_default()

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 18, 2025

r? @Jarcho

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

Copy link
Contributor

@Jarcho Jarcho left a comment

Choose a reason for hiding this comment

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

@Jarcho Jarcho added this pull request to the merge queue Sep 18, 2025
Merged via the queue into rust-lang:master with commit 4a8b7ea Sep 18, 2025
11 of 13 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Sep 18, 2025
@samueltardieu samueltardieu deleted the unwrap-or-empty-vec branch September 18, 2025 15:23
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.

3 participants