Skip to content

Commit c93bc6e

Browse files
committed
Use #[derive(Default)] instead of implementing it on manually
This feature has been stabilized as of 1.62 rust-lang/rust#94457
1 parent a71dd52 commit c93bc6e

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

src/types.rs

+5-8
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,17 @@ pub enum AspectFull<'a> {
99
Song(&'a Song),
1010
}
1111

12+
// you can derive Default in Rust 1.62 https://github.com/rust-lang/rust/pull/94457/
13+
#[derive(Default)]
1214
pub enum Aspect {
1315
Artists,
1416
Albums,
17+
// bc Rust still doesn't have default argument values
18+
// https://www.reddit.com/r/rust/comments/fi6nov/why_does_rust_not_support_default_arguments/fkfezxv/
19+
#[default]
1520
Songs,
1621
}
1722

18-
// bc Rust still doesn't have default argument values
19-
// https://www.reddit.com/r/rust/comments/fi6nov/why_does_rust_not_support_default_arguments/fkfezxv/
20-
impl Default for Aspect {
21-
fn default() -> Self {
22-
Aspect::Songs
23-
}
24-
}
25-
2623
pub trait Music: Display {}
2724

2825
#[derive(PartialEq, Eq, Hash, Debug, Clone)]

0 commit comments

Comments
 (0)