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

Use #[derive(Default)] instead of manual impl when possible #134363

Merged
merged 1 commit into from
Dec 23, 2024

Conversation

estebank
Copy link
Contributor

While working on #134175 I noticed a few manual Default impls that could be derived instead. These likely predate the existence of the #[default] attribute for enums.

@rustbot
Copy link
Collaborator

rustbot commented Dec 16, 2024

r? @SparrowLii

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

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

rustbot commented Dec 16, 2024

Some changes occurred in src/tools/rustfmt

cc @rust-lang/rustfmt

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to open a PR in https://github.com/rust-lang/rustfmt for these changes?

Copy link
Member

@SparrowLii SparrowLii left a comment

Choose a reason for hiding this comment

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

I think they are nice clean ups!

library/core/src/default.rs Outdated Show resolved Hide resolved
@bors
Copy link
Contributor

bors commented Dec 18, 2024

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

@estebank estebank force-pushed the derive-default branch 2 times, most recently from 636926b to a64347c Compare December 21, 2024 20:33
@rust-log-analyzer

This comment has been minimized.

Copy link
Member

@SparrowLii SparrowLii left a comment

Choose a reason for hiding this comment

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

The commits should be cleaned.
Please r=me after that

@SparrowLii
Copy link
Member

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 23, 2024

📌 Commit 1f82b45 has been approved by SparrowLii

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 Dec 23, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#134363 (Use `#[derive(Default)]` instead of manual `impl` when possible)
 - rust-lang#134517 (Add tests for coverage attribute on trait functions)
 - rust-lang#134528 (opt-dist: propagate channel info to bootstrap)
 - rust-lang#134669 (Document the `--dev` flag for `src/ci/docker/run.sh`)
 - rust-lang#134680 (Clean up a few rmake tests  )

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#134363 (Use `#[derive(Default)]` instead of manual `impl` when possible)
 - rust-lang#134517 (Add tests for coverage attribute on trait functions)
 - rust-lang#134528 (opt-dist: propagate channel info to bootstrap)
 - rust-lang#134669 (Document the `--dev` flag for `src/ci/docker/run.sh`)
 - rust-lang#134680 (Clean up a few rmake tests  )

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 95c33e3 into rust-lang:master Dec 23, 2024
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Dec 23, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Dec 23, 2024
Rollup merge of rust-lang#134363 - estebank:derive-default, r=SparrowLii

Use `#[derive(Default)]` instead of manual `impl` when possible

While working on rust-lang#134175 I noticed a few manual `Default` `impl`s that could be `derive`d instead. These likely predate the existence of the `#[default]` attribute for `enum`s.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. 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.

6 participants