Skip to content

Commit b49578e

Browse files
committed
refactor: clippy fixes
1 parent d007e3a commit b49578e

1 file changed

Lines changed: 8 additions & 28 deletions

File tree

playback/src/config.rs

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ use std::{mem, str::FromStr, time::Duration};
33
pub use crate::dither::{DithererBuilder, TriangularDitherer, mk_ditherer};
44
use crate::{convert::i24, player::duration_to_coefficient};
55

6-
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
6+
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
77
pub enum Bitrate {
88
Bitrate96,
9+
#[default]
910
Bitrate160,
1011
Bitrate320,
1112
}
@@ -22,19 +23,14 @@ impl FromStr for Bitrate {
2223
}
2324
}
2425

25-
impl Default for Bitrate {
26-
fn default() -> Self {
27-
Self::Bitrate160
28-
}
29-
}
30-
31-
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)]
26+
#[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq, Default)]
3227
pub enum AudioFormat {
3328
F64,
3429
F32,
3530
S32,
3631
S24,
3732
S24_3,
33+
#[default]
3834
S16,
3935
}
4036

@@ -53,12 +49,6 @@ impl FromStr for AudioFormat {
5349
}
5450
}
5551

56-
impl Default for AudioFormat {
57-
fn default() -> Self {
58-
Self::S16
59-
}
60-
}
61-
6252
impl AudioFormat {
6353
// not used by all backends
6454
#[allow(dead_code)]
@@ -73,10 +63,11 @@ impl AudioFormat {
7363
}
7464
}
7565

76-
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
66+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
7767
pub enum NormalisationType {
7868
Album,
7969
Track,
70+
#[default]
8071
Auto,
8172
}
8273

@@ -92,15 +83,10 @@ impl FromStr for NormalisationType {
9283
}
9384
}
9485

95-
impl Default for NormalisationType {
96-
fn default() -> Self {
97-
Self::Auto
98-
}
99-
}
100-
101-
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
86+
#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
10287
pub enum NormalisationMethod {
10388
Basic,
89+
#[default]
10490
Dynamic,
10591
}
10692

@@ -115,12 +101,6 @@ impl FromStr for NormalisationMethod {
115101
}
116102
}
117103

118-
impl Default for NormalisationMethod {
119-
fn default() -> Self {
120-
Self::Dynamic
121-
}
122-
}
123-
124104
#[derive(Clone)]
125105
pub struct PlayerConfig {
126106
pub bitrate: Bitrate,

0 commit comments

Comments
 (0)