Skip to content

chore: Fix the lint warnings

Sign in for the full log view
GitHub Actions / clippy succeeded May 21, 2024 in 1s

clippy

60 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 60
Note 0
Help 0

Versions

  • rustc 1.80.0-nightly (b92758a9a 2024-05-20)
  • cargo 1.80.0-nightly (0de7f2ec6 2024-05-17)
  • clippy 0.1.80 (b92758a 2024-05-20)

Annotations

Check warning on line 415 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:415:5
    |
415 |     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 132 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:132:5
    |
132 |     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 54 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:54:1
   |
54 | pub mod search;
   | ^^^^^^^^^^^^^^

Check warning on line 53 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:53:1
   |
53 | pub mod evaluation;
   | ^^^^^^^^^^^^^^^^^^

Check warning on line 52 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:52:1
   |
52 | pub mod engine;
   | ^^^^^^^^^^^^^^
   |
note: the lint level is defined here
  --> src/lib.rs:11:9
   |
11 | #![warn(missing_docs, variant_size_differences)]
   |         ^^^^^^^^^^^^

Check warning on line 184 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:184:17
    |
184 |                 writeln!(output, "Unknown command: {}", line).unwrap();
    |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
    |
184 -                 writeln!(output, "Unknown command: {}", line).unwrap();
184 +                 writeln!(output, "Unknown command: {line}").unwrap();
    |

Check warning on line 21 in src/interface/uci.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/interface/uci.rs:21:1
   |
21 | pub fn run_loop(input: &mut impl BufRead, output: &mut impl Write) {
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
note: first possible panic found here
  --> src/interface/uci.rs:29:23
   |
29 |             Err(e) => panic!("Error reading from input: {}", e),
   |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 11 in src/evaluation/material.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/evaluation/material.rs:9:1
   |
9  | / fn material_advantage(position: &Position) -> f32 {
10 | |     0.
11 | | }
   | |_^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_const_for_fn

Check warning on line 790 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:776:1
    |
776 | / fn generate_pawn_moves(
777 | |     pawns: Bitboard,
778 | |     us: Player,
779 | |     they: Player,
...   |
789 | |     moves: &mut MoveList,
790 | | ) {
    | |_^
    |
    = 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:42:5
    |
42  |     clippy::complexity,
    |     ^^^^^^^^^^^^^^^^^^
    = note: `#[warn(clippy::too_many_arguments)]` implied by `#[warn(clippy::complexity)]`

Check warning on line 415 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:415:5
    |
415 |     pub fn make_move(&mut self, next_move: &Move) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> src/chess/position.rs:477:38
    |
477 |             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

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

See this annotation in the file changed.

@github-actions github-actions / clippy

you are deriving `PartialEq` and can implement `Eq`

warning: you are deriving `PartialEq` and can implement `Eq`
   --> src/chess/core.rs:632:30
    |
632 | #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
    |                              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq

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

See this annotation in the file changed.

@github-actions github-actions / clippy

you are deriving `PartialEq` and can implement `Eq`

warning: you are deriving `PartialEq` and can implement `Eq`
   --> src/chess/core.rs:383:30
    |
383 | #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
    |                              ^^^^^^^^^ help: consider deriving `Eq` as well: `PartialEq, Eq`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_partial_eq_without_eq
    = note: `#[warn(clippy::derive_partial_eq_without_eq)]` implied by `#[warn(clippy::nursery)]`

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

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
   --> src/chess/core.rs:315:39
    |
315 |             0..=7 => Ok(unsafe { mem::transmute(row) }),
    |                                       ^^^^^^^^^ help: consider adding missing annotations: `transmute::<u8, chess::core::Rank>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
   --> src/chess/core.rs:304:43
    |
304 |             '1'..='8' => Ok(unsafe { mem::transmute(rank as u8 - b'1') }),
    |                                           ^^^^^^^^^ help: consider adding missing annotations: `transmute::<u8, chess::core::Rank>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
   --> src/chess/core.rs:245:39
    |
245 |             0..=7 => Ok(unsafe { mem::transmute(column) }),
    |                                       ^^^^^^^^^ help: consider adding missing annotations: `transmute::<u8, chess::core::File>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

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

See this annotation in the file changed.

@github-actions github-actions / clippy

transmute used without annotations

warning: transmute used without annotations
   --> src/chess/core.rs:234:43
    |
234 |             'a'..='h' => Ok(unsafe { mem::transmute(file as u8 - b'a') }),
    |                                           ^^^^^^^^^ help: consider adding missing annotations: `transmute::<u8, chess::core::File>`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_transmute_annotations

Check warning on line 193 in src/chess/core.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/core.rs:187:9
    |
187 | /         let (file, rank) = match square.chars().collect_tuple() {
188 | |             Some((file, rank)) => (file, rank),
189 | |             None => bail!(
190 | |                 "square should be two-char, got {square} with {} chars",
191 | |                 square.bytes().len()
192 | |             ),
193 | |         };
    | |__________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_let_else
    = note: `#[warn(clippy::manual_let_else)]` implied by `#[warn(clippy::pedantic)]`
help: consider writing
    |
187 ~         let Some((file, rank)) = square.chars().collect_tuple() else { bail!(
188 +                 "square should be two-char, got {square} with {} chars",
189 +                 square.bytes().len()
190 +             ) };
    |