Skip to content

Commit 556e33c

Browse files
committed
chore: cargo clippy
1 parent 4096618 commit 556e33c

File tree

5 files changed

+12
-42
lines changed

5 files changed

+12
-42
lines changed

bathbot/src/commands/fun/bg_game/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,10 @@ pub enum BgGameMode {
133133
Mania,
134134
}
135135

136-
#[derive(Copy, Clone, Debug, CommandOption, CreateOption)]
136+
#[derive(Copy, Clone, Debug, CommandOption, CreateOption, Default)]
137137
pub enum GameDifficulty {
138138
#[option(name = "Normal", value = "normal")]
139+
#[default]
139140
Normal,
140141
#[option(name = "Hard", value = "hard")]
141142
Hard,
@@ -153,12 +154,6 @@ impl GameDifficulty {
153154
}
154155
}
155156

156-
impl Default for GameDifficulty {
157-
fn default() -> Self {
158-
Self::Normal
159-
}
160-
}
161-
162157
/// When users install the bot as an app, they can use the command even if it's
163158
/// disabled in a guild. This function makes sure that the command is not
164159
/// disabled.

bathbot/src/commands/fun/minesweeper.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,11 @@ impl Game {
155155
}
156156
}
157157

158-
#[derive(Clone, Copy, Eq, PartialEq)]
158+
#[derive(Clone, Copy, Default, Eq, PartialEq)]
159159
enum Cell {
160160
Num(u8),
161161
Mine,
162+
#[default]
162163
None,
163164
}
164165

@@ -179,9 +180,3 @@ impl Display for Cell {
179180
}
180181
}
181182
}
182-
183-
impl Default for Cell {
184-
fn default() -> Self {
185-
Self::None
186-
}
187-
}

bathbot/src/commands/osu/map_search.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ impl From<SearchLanguage> for Language {
169169
}
170170
}
171171

172-
#[derive(Copy, Clone, CommandOption, CreateOption, Debug, Eq, PartialEq)]
172+
#[derive(Copy, Clone, CommandOption, CreateOption, Debug, Default, Eq, PartialEq)]
173173
pub enum SearchOrder {
174174
#[option(name = "Artist", value = "artist")]
175175
Artist,
@@ -182,19 +182,14 @@ pub enum SearchOrder {
182182
#[option(name = "Rating", value = "rating")]
183183
Rating,
184184
#[option(name = "Relevance", value = "relevance")]
185+
#[default]
185186
Relevance,
186187
#[option(name = "Stars", value = "stars")]
187188
Stars,
188189
#[option(name = "Title", value = "title")]
189190
Title,
190191
}
191192

192-
impl Default for SearchOrder {
193-
fn default() -> Self {
194-
Self::Relevance
195-
}
196-
}
197-
198193
impl From<SearchOrder> for BeatmapsetSearchSort {
199194
fn from(order: SearchOrder) -> Self {
200195
match order {

bathbot/src/commands/osu/match_compare.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,36 +28,26 @@ pub struct MatchCompare {
2828
comparison: Option<MatchCompareComparison>,
2929
}
3030

31-
#[derive(CommandOption, CreateOption)]
31+
#[derive(CommandOption, CreateOption, Default)]
3232
pub enum MatchCompareOutput {
3333
#[option(name = "Full", value = "full")]
3434
Full,
3535
#[option(name = "Paginated", value = "paginated")]
36+
#[default]
3637
Paginated,
3738
}
3839

39-
impl Default for MatchCompareOutput {
40-
fn default() -> Self {
41-
Self::Paginated
42-
}
43-
}
44-
45-
#[derive(Copy, Clone, CommandOption, CreateOption)]
40+
#[derive(Copy, Clone, CommandOption, CreateOption, Default)]
4641
pub enum MatchCompareComparison {
4742
#[option(name = "Compare players", value = "players")]
43+
#[default]
4844
Players,
4945
#[option(name = "Compare teams", value = "teams")]
5046
Teams,
5147
#[option(name = "Compare both", value = "both")]
5248
Both,
5349
}
5450

55-
impl Default for MatchCompareComparison {
56-
fn default() -> Self {
57-
Self::Players
58-
}
59-
}
60-
6151
async fn slash_matchcompare(mut command: InteractionCommand) -> Result<()> {
6252
let args = MatchCompare::from_interaction(command.input_data())?;
6353

bathbot/src/commands/osu/osustats/mod.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub struct OsuStatsBest {
132132
sort: Option<OsuStatsBestSort>,
133133
}
134134

135-
#[derive(Copy, Clone, CommandOption, CreateOption)]
135+
#[derive(Copy, Clone, CommandOption, CreateOption, Default)]
136136
pub enum OsuStatsBestSort {
137137
#[option(name = "Accuracy", value = "acc")]
138138
Accuracy,
@@ -145,17 +145,12 @@ pub enum OsuStatsBestSort {
145145
#[option(name = "Misses", value = "miss")]
146146
Misses,
147147
#[option(name = "PP", value = "pp")]
148+
#[default]
148149
Pp,
149150
#[option(name = "Score", value = "score")]
150151
Score,
151152
}
152153

153-
impl Default for OsuStatsBestSort {
154-
fn default() -> Self {
155-
Self::Pp
156-
}
157-
}
158-
159154
async fn slash_osustats(mut command: InteractionCommand) -> Result<()> {
160155
match OsuStats::from_interaction(command.input_data())? {
161156
OsuStats::Count(args) => count((&mut command).into(), args).await,

0 commit comments

Comments
 (0)