-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #98873 - TaKO8Ki:suggest-default-derive-to-enum-with-…
…default-attribute, r=fee1-dead Suggest `#[derive(Default)]` to enums with `#[default]` fixes #95226
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pub enum Test { //~ HELP consider adding `#[derive(Default)]` to this enum | ||
#[default] | ||
//~^ ERROR cannot find attribute `default` in this scope | ||
First, | ||
Second, | ||
} | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
error: cannot find attribute `default` in this scope | ||
--> $DIR/suggest-default-attribute.rs:2:7 | ||
| | ||
LL | #[default] | ||
| ^^^^^^^ | ||
| | ||
help: consider adding `#[derive(Default)]` to this enum | ||
--> $DIR/suggest-default-attribute.rs:1:1 | ||
| | ||
LL | pub enum Test { | ||
| ^^^^^^^^^^^^^ | ||
|
||
error: aborting due to previous error | ||
|