Skip to content

Commit

Permalink
use rust 1.81 expect lint
Browse files Browse the repository at this point in the history
  • Loading branch information
andy-k committed Sep 7, 2024
1 parent 2652413 commit d0403ae
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 36 deletions.
2 changes: 1 addition & 1 deletion src/alphabet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ impl std::fmt::Display for WriteableRack<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
for &tile in self.rack {
Expand Down
10 changes: 5 additions & 5 deletions src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ impl std::fmt::Display for ColumnStr {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
if self.0 >= 26 {
Expand Down Expand Up @@ -117,7 +117,7 @@ impl std::fmt::Display for BoardPrinter<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
let ncols: i8 = self.board_layout.dim().cols;
Expand Down Expand Up @@ -195,7 +195,7 @@ impl std::fmt::Display for BoardFenner<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
let mut p = 0usize;
Expand Down Expand Up @@ -329,7 +329,7 @@ impl std::fmt::Display for MsPrinter {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
let mut ms = self.ms;
Expand All @@ -356,7 +356,7 @@ impl std::fmt::Display for GameStatePrinter<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
writeln!(
Expand Down
22 changes: 0 additions & 22 deletions src/game_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ impl GameConfig {
}
}

#[allow(dead_code)]
pub fn make_catalan_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -151,7 +150,6 @@ pub fn make_catalan_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_catalan_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -169,7 +167,6 @@ pub fn make_jumbled_catalan_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_super_catalan_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -187,7 +184,6 @@ pub fn make_super_catalan_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_super_catalan_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand Down Expand Up @@ -222,7 +218,6 @@ pub fn make_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -240,7 +235,6 @@ pub fn make_jumbled_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_punctured_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -258,7 +252,6 @@ pub fn make_punctured_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_punctured_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -276,7 +269,6 @@ pub fn make_jumbled_punctured_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_hong_kong_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -294,7 +286,6 @@ pub fn make_hong_kong_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_super_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -312,7 +303,6 @@ pub fn make_super_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_super_english_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -330,7 +320,6 @@ pub fn make_jumbled_super_english_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_french_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -348,7 +337,6 @@ pub fn make_french_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_french_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -366,7 +354,6 @@ pub fn make_jumbled_french_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_german_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -384,7 +371,6 @@ pub fn make_german_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_german_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -402,7 +388,6 @@ pub fn make_jumbled_german_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_norwegian_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -420,7 +405,6 @@ pub fn make_norwegian_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_norwegian_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -440,7 +424,6 @@ pub fn make_jumbled_norwegian_game_config() -> GameConfig {

// http://www.pfs.org.pl/regulaminy.php
// select the second tab.
#[allow(dead_code)]
pub fn make_polish_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -458,7 +441,6 @@ pub fn make_polish_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_polish_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -476,7 +458,6 @@ pub fn make_jumbled_polish_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_slovene_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -494,7 +475,6 @@ pub fn make_slovene_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_slovene_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand All @@ -513,7 +493,6 @@ pub fn make_jumbled_slovene_game_config() -> GameConfig {
}

// https://fisescrabble.org/reglamentos/modalidad-clasica/
#[allow(dead_code)]
pub fn make_spanish_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Classic,
Expand All @@ -531,7 +510,6 @@ pub fn make_spanish_game_config() -> GameConfig {
})
}

#[allow(dead_code)]
pub fn make_jumbled_spanish_game_config() -> GameConfig {
GameConfig::Static(StaticGameConfig {
game_rules: GameRules::Jumbled,
Expand Down
1 change: 0 additions & 1 deletion src/main_endgame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ impl Question {
game_state.set_current_rack(&v);
let mut move_to_play = None;
if coord_token.is_empty() {
#[allow(clippy::if_same_then_else)]
if word_token == "-" && move_score == 0 {
// pass
move_to_play = Some(movegen::Play::Exchange {
Expand Down
2 changes: 1 addition & 1 deletion src/main_read.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl AlphabetLabel for QuackleLeavesAlphabetLabel {
}
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
fn iter_dawg<
F: FnMut(&str) -> error::Returns<()>,
In: FnMut(u8) -> error::Returns<Option<u8>>,
Expand Down
2 changes: 1 addition & 1 deletion src/move_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ impl Periods {
}
}

#[allow(clippy::large_enum_variant)]
#[expect(clippy::large_enum_variant)]
pub enum MovePicker<'a> {
Hasty,
Simmer(Simmer<'a>),
Expand Down
3 changes: 1 addition & 2 deletions src/movegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2213,7 +2213,7 @@ impl std::fmt::Display for WriteablePlay<'_> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
if f.width().is_some() {
// allocates, but no choice.
#[allow(clippy::recursive_format_impl)]
#[expect(clippy::recursive_format_impl)]
return f.pad(&format!("{self}"));
}
match &self.play {
Expand Down Expand Up @@ -2331,7 +2331,6 @@ impl KurniaMoveGenerator {
}

// skip equity computation and sorting
#[allow(dead_code)]
pub fn gen_moves_raw_all_unsorted<'a>(
&mut self,
board_snapshot: &'a BoardSnapshot<'a>,
Expand Down
3 changes: 0 additions & 3 deletions src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ impl Stats {
}

// https://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#Parallel_algorithm
#[allow(dead_code)]
#[inline(always)]
pub fn update_bulk(&mut self, other: &Stats) {
let original_count = self.count;
Expand All @@ -48,7 +47,6 @@ impl Stats {
}
}

#[allow(dead_code)]
#[inline(always)]
pub fn count(&self) -> f64 {
self.count
Expand All @@ -69,7 +67,6 @@ impl Stats {
}
}

#[allow(dead_code)]
#[inline(always)]
pub fn standard_deviation(&self) -> f64 {
self.variance().sqrt()
Expand Down

0 comments on commit d0403ae

Please sign in to comment.