Skip to content

chore: Continue fixing issues reported by Clippy #113

chore: Continue fixing issues reported by Clippy

chore: Continue fixing issues reported by Clippy #113

GitHub Actions / clippy failed May 17, 2024 in 1s

clippy

8 errors, 51 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 8
Warning 51
Note 0
Help 0

Versions

  • rustc 1.80.0-nightly (8c127df75 2024-05-16)
  • cargo 1.80.0-nightly (4de0094ac 2024-05-09)
  • clippy 0.1.80 (8c127df 2024-05-16)

Annotations

Check warning on line 6 in src/util.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a function

warning: missing documentation for a function
 --> src/util.rs:6:1
  |
6 | pub fn sanitize_fen(position: &str) -> String {
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 3 in src/interface.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a module

warning: missing documentation for a module
 --> src/interface.rs:3:1
  |
3 | pub mod uci;
  | ^^^^^^^^^^^

Check warning on line 1 in src/evaluation/evaluator.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a trait

warning: missing documentation for a trait
 --> src/evaluation/evaluator.rs:1:1
  |
1 | pub trait Evaluator {}
  | ^^^^^^^^^^^^^^^^^^^

Check warning on line 1 in src/evaluation.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a module

warning: missing documentation for a module
 --> src/evaluation.rs:1:1
  |
1 | pub mod evaluator;
  | ^^^^^^^^^^^^^^^^^

Check warning on line 417 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a method

warning: missing documentation for a method
   --> src/chess/position.rs:417:5
    |
417 |     pub fn make_move(&mut self, next_move: &Move) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 275 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a method

warning: missing documentation for a method
   --> src/chess/position.rs:275:5
    |
275 |     pub fn is_legal(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 270 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a method

warning: missing documentation for a method
   --> src/chess/position.rs:270:5
    |
270 |     pub fn has_insufficient_material(&self) -> bool {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 134 in src/chess/core.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a method

warning: missing documentation for a method
   --> src/chess/core.rs:134:5
    |
134 |     pub fn shift(self, direction: Direction) -> Option<Self> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 49 in src/chess/core.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for an associated function

warning: missing documentation for an associated function
  --> src/chess/core.rs:49:5
   |
49 |     pub fn from_san(_position: &Position) -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 40 in src/chess/core.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for an associated function

warning: missing documentation for an associated function
  --> src/chess/core.rs:40:5
   |
40 |     pub const fn new(from: Square, to: Square, promotion: Option<Promotion>) -> Self {
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 57 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a constant

warning: missing documentation for a constant
  --> src/lib.rs:57:1
   |
57 | pub const VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/version"));
   | ^^^^^^^^^^^^^^^^^^^^^^^

Check warning on line 50 in src/lib.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

missing documentation for a module

warning: missing documentation for a module
  --> src/lib.rs:50:1
   |
50 | pub mod evaluation;
   | ^^^^^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:11:9
   |
11 | #![warn(missing_docs, variant_size_differences)]
   |         ^^^^^^^^^^^^

Check warning on line 62 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

variables can be used directly in the `format!` string

warning: variables can be used directly in the `format!` string
  --> src/interface/uci.rs:62:17
   |
62 |                 println!("Unknown command: {}", input);
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
   |
62 -                 println!("Unknown command: {}", input);
62 +                 println!("Unknown command: {input}");
   |

Check warning on line 44 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the loop variable `i` is only used to index `tokens`

warning: the loop variable `i` is only used to index `tokens`
  --> src/interface/uci.rs:44:30
   |
44 |                     for i in 3..tokens.len() {
   |                              ^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_range_loop
note: the lint level is defined here
  --> src/lib.rs:41:5
   |
41 |     clippy::style,
   |     ^^^^^^^^^^^^^
   = note: `#[warn(clippy::needless_range_loop)]` implied by `#[warn(clippy::style)]`
help: consider using an iterator
   |
44 |                     for <item> in tokens.iter().skip(3) {
   |                         ~~~~~~    ~~~~~~~~~~~~~~~~~~~~~

Check warning on line 11 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

indexing into a vector may panic

warning: indexing into a vector may panic
  --> src/interface/uci.rs:11:15
   |
11 |         match tokens[0] {
   |               ^^^^^^^^^ help: try: `tokens.get(0)`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_on_vec_items
   = note: `#[warn(clippy::match_on_vec_items)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 31 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm
  --> src/interface/uci.rs:29:13
   |
29 |               "setoption" => {
   |               ^----------
   |               |
   |  _____________help: try merging the arm patterns: `"setoption" | "ucinewgame"`
   | |
30 | |                 // Handle engine options
31 | |             },
   | |_____________^
   |
   = help: or try changing either arm body
note: other arm here
  --> src/interface/uci.rs:32:13
   |
32 | /             "ucinewgame" => {
33 | |                 // Handle new game setup
34 | |             },
   | |_____________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 24 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm
  --> src/interface/uci.rs:22:13
   |
22 |               "debug" => {
   |               ^------
   |               |
   |  _____________help: try merging the arm patterns: `"debug" | "ucinewgame"`
   | |
23 | |                 // Handle debug mode
24 | |             },
   | |_____________^
   |
   = help: or try changing either arm body
note: other arm here
  --> src/interface/uci.rs:32:13
   |
32 | /             "ucinewgame" => {
33 | |                 // Handle new game setup
34 | |             },
   | |_____________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms

Check warning on line 24 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this match arm has an identical body to another arm

warning: this match arm has an identical body to another arm
  --> src/interface/uci.rs:22:13
   |
22 |               "debug" => {
   |               ^------
   |               |
   |  _____________help: try merging the arm patterns: `"debug" | "setoption"`
   | |
23 | |                 // Handle debug mode
24 | |             },
   | |_____________^
   |
   = help: or try changing either arm body
note: other arm here
  --> src/interface/uci.rs:29:13
   |
29 | /             "setoption" => {
30 | |                 // Handle engine options
31 | |             },
   | |_____________^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
   = note: `#[warn(clippy::match_same_arms)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 5 in src/interface/uci.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

temporary with significant `Drop` can be early dropped

warning: temporary with significant `Drop` can be early dropped
  --> src/interface/uci.rs:5:13
   |
3  |   fn run() {
   |  __________-
4  | |     let stdin = io::stdin();
5  | |     let mut lines = stdin.lock().lines().map(|line| line.unwrap());
   | |             ^^^^^
...  |
65 | |     }
66 | | }
   | |_- temporary `lines` is currently being dropped at the end of its contained scope
   |
   = note: this might lead to unnecessary resource contention
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#significant_drop_tightening
   = note: `#[warn(clippy::significant_drop_tightening)]` implied by `#[warn(clippy::nursery)]`
help: merge the temporary construction with its single usage
   |
5  ~     
6  +         let input = stdin.lock().lines().map(|line| line.unwrap()).unwrap();
   |
help: remove separated single usage
   |
8  -         let input = lines.next().unwrap();
8  +         
   |

Check warning on line 792 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many arguments (13/7)

warning: this function has too many arguments (13/7)
   --> src/chess/position.rs:778:1
    |
778 | / fn generate_pawn_moves(
779 | |     pawns: Bitboard,
780 | |     us: Player,
781 | |     they: Player,
...   |
791 | |     moves: &mut MoveList,
792 | | ) {
    | |_^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments
note: the lint level is defined here
   --> src/lib.rs:43:5
    |
43  |     clippy::complexity,
    |     ^^^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::too_many_arguments)]` implied by `#[warn(clippy::complexity)]`

Check warning on line 417 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function which may panic missing `# Panics` section

warning: docs for function which may panic missing `# Panics` section
   --> src/chess/position.rs:417:5
    |
417 |     pub fn make_move(&mut self, next_move: &Move) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/chess/position.rs:479:38
    |
479 |             let single_push_square = next_move.from.shift(us.push_direction()).unwrap();
    |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 156 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this could be rewritten as `let...else`

warning: this could be rewritten as `let...else`
   --> src/chess/position.rs:153:9
    |
153 | /         let pieces_placement = match parts.next() {
154 | |             Some(placement) => placement,
155 | |             None => bail!("incorrect FEN: missing pieces placement"),
156 | |         };
    | |__________^ help: consider writing: `let Some(pieces_placement) = parts.next() else { bail!("incorrect FEN: missing pieces placement") };`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else

Check warning on line 261 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this function has too many lines (107/100)

warning: this function has too many lines (107/100)
   --> src/chess/position.rs:149:5
    |
149 | /     pub fn from_fen(input: &str) -> anyhow::Result<Self> {
150 | |         let mut parts = input.split(' ');
151 | |         // Parse Piece Placement.
152 | |         let mut result = Self::empty();
...   |
260 | |         }
261 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_lines
    = note: `#[warn(clippy::too_many_lines)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 149 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

docs for function returning `Result` missing `# Errors` section

warning: docs for function returning `Result` missing `# Errors` section
   --> src/chess/position.rs:149:5
    |
149 |     pub fn from_fen(input: &str) -> anyhow::Result<Self> {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_errors_doc
    = note: `#[warn(clippy::missing_errors_doc)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 104 in src/chess/position.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this could be a `const fn`

warning: this could be a `const fn`
   --> src/chess/position.rs:102:5
    |
102 | /     pub(super) fn they(&self) -> Player {
103 | |         self.us().opponent()
104 | |     }
    | |_____^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn