Skip to content

Add composite search strategies #1873

Add composite search strategies

Add composite search strategies #1873

GitHub Actions / clippy succeeded Jan 31, 2024 in 0s

clippy

11 warnings

Details

Results

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

Versions

  • rustc 1.65.0 (897e37553 2022-11-02)
  • cargo 1.65.0 (4bc8f24d3 2022-10-20)
  • clippy 0.1.65 (897e375 2022-11-02)

Annotations

Check warning on line 151 in cgaal-cli/src/args.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> cgaal-cli/src/args.rs:151:99
    |
151 |         Some(multiple) if multiple.contains(",") => Ok(SearchStrategyOption::Compo(multiple.split(",").map(|ss| match ss {
    |                                                                                                   ^^^ help: try using a `char` instead: `','`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

Check warning on line 151 in cgaal-cli/src/args.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

single-character string constant used as pattern

warning: single-character string constant used as pattern
   --> cgaal-cli/src/args.rs:151:45
    |
151 |         Some(multiple) if multiple.contains(",") => Ok(SearchStrategyOption::Compo(multiple.split(",").map(|ss| match ss {
    |                                             ^^^ help: try using a `char` instead: `','`
    |
    = note: `#[warn(clippy::single_char_pattern)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_char_pattern

Check warning on line 24 in cgaal-engine/src/parsing/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `unwrap_or` followed by a function call

warning: use of `unwrap_or` followed by a function call
  --> cgaal-engine/src/parsing/mod.rs:24:10
   |
24 |         .unwrap_or(Expr::new_error());
   |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `unwrap_or_else(|_| Expr::new_error())`
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

Check warning on line 516 in cgaal-engine/src/game_structure/lcgs/symbol_checker.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `ok_or` followed by a function call

warning: use of `ok_or` followed by a function call
   --> cgaal-engine/src/game_structure/lcgs/symbol_checker.rs:513:18
    |
513 |                   .ok_or(SpannedError::new(
    |  __________________^
514 | |                     id.span,
515 | |                     format!("Unknown player '{}'.", id.text),
516 | |                 ))?;
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
help: try this
    |
513 ~                 .ok_or_else(|| SpannedError::new(
514 +                     id.span,
515 +                     format!("Unknown player '{}'.", id.text),
516 ~                 ))?;
    |

Check warning on line 339 in cgaal-engine/src/game_structure/lcgs/symbol_checker.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `ok_or` followed by a function call

warning: use of `ok_or` followed by a function call
   --> cgaal-engine/src/game_structure/lcgs/symbol_checker.rs:336:14
    |
336 |               .ok_or(SpannedError::new(
    |  ______________^
337 | |                 *span,
338 | |                 format!("Unknown declaration '{}'.", oi),
339 | |             ))?;
    | |______________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
help: try this
    |
336 ~             .ok_or_else(|| SpannedError::new(
337 +                 *span,
338 +                 format!("Unknown declaration '{}'.", oi),
339 ~             ))?;
    |

Check warning on line 325 in cgaal-engine/src/game_structure/lcgs/symbol_checker.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `ok_or` followed by a function call

warning: use of `ok_or` followed by a function call
   --> cgaal-engine/src/game_structure/lcgs/symbol_checker.rs:322:18
    |
322 |                   .ok_or(SpannedError::new(
    |  __________________^
323 | |                     player_name.span,
324 | |                     format!("Unknown player '{}'.", player_name.text),
325 | |                 ))?;
    | |__________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call
help: try this
    |
322 ~                 .ok_or_else(|| SpannedError::new(
323 +                     player_name.span,
324 +                     format!("Unknown player '{}'.", player_name.text),
325 ~                 ))?;
    |

Check warning on line 313 in cgaal-engine/src/game_structure/lcgs/symbol_checker.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

use of `or` followed by a function call

warning: use of `or` followed by a function call
   --> cgaal-engine/src/game_structure/lcgs/symbol_checker.rs:313:30
    |
313 |             oi.owner.clone().or(self.scope_owner.clone()),
    |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try this: `or_else(|| self.scope_owner.clone())`
    |
    = note: `#[warn(clippy::or_fun_call)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#or_fun_call

Check warning on line 124 in cgaal-engine/src/algorithms/certain_zero/search_strategy/linear_representative_search.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> cgaal-engine/src/algorithms/certain_zero/search_strategy/linear_representative_search.rs:124:58
    |
124 |                     dist += (state.0[&state_var] - rep.0[&state_var]).unsigned_abs();
    |                                                          ^^^^^^^^^^ help: change this to: `state_var`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 124 in cgaal-engine/src/algorithms/certain_zero/search_strategy/linear_representative_search.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

this expression creates a reference which is immediately dereferenced by the compiler

warning: this expression creates a reference which is immediately dereferenced by the compiler
   --> cgaal-engine/src/algorithms/certain_zero/search_strategy/linear_representative_search.rs:124:38
    |
124 |                     dist += (state.0[&state_var] - rep.0[&state_var]).unsigned_abs();
    |                                      ^^^^^^^^^^ help: change this to: `state_var`
    |
    = note: `#[warn(clippy::needless_borrow)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow

Check warning on line 134 in cgaal-engine/src/algorithms/certain_zero/search_strategy/composite.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unneeded `return` statement

warning: unneeded `return` statement
   --> cgaal-engine/src/algorithms/certain_zero/search_strategy/composite.rs:134:9
    |
134 |         return ss;
    |         ^^^^^^^^^^ help: remove `return`: `ss`
    |
    = note: `#[warn(clippy::needless_return)]` on by default
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_return

Check warning on line 96 in cgaal-engine/src/algorithms/certain_zero/search_strategy/composite.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

length comparison to zero

warning: length comparison to zero
  --> cgaal-engine/src/algorithms/certain_zero/search_strategy/composite.rs:96:13
   |
96 |             strategies.len() > 0,
   |             ^^^^^^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!strategies.is_empty()`
   |
   = note: `#[warn(clippy::len_zero)]` on by default
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero