Skip to content

Fix clippy warning #1875

Fix clippy warning

Fix clippy warning #1875

GitHub Actions / clippy succeeded Feb 1, 2024 in 0s

clippy

7 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 0
Warning 7
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 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