Skip to content

clippy

clippy #36

GitHub Actions / clippy failed Mar 12, 2024 in 0s

clippy

16 errors, 13 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 16
Warning 13
Note 0
Help 0

Versions

  • rustc 1.78.0-nightly (4a0cc881d 2024-03-11)
  • cargo 1.78.0-nightly (a4c63fe53 2024-03-06)
  • clippy 0.1.78 (4a0cc88 2024-03-11)

Annotations

Check failure on line 617 in cofd/lib/src/splat/werewolf.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
   --> cofd/lib/src/splat/werewolf.rs:617:36
    |
617 |         ModifierTarget::Trait(trait_) => character.get_trait(trait_) as i16,
    |                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check warning on line 616 in cofd/lib/src/splat/werewolf.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
   --> cofd/lib/src/splat/werewolf.rs:616:66
    |
616 |         ModifierTarget::Attribute(attr) => *character.attributes().get(&attr) as i16,
    |                                                                        ^^^^^ help: change this to: `attr`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
    = note: `#[warn(clippy::needless_borrow)]` on by default

Check failure on line 616 in cofd/lib/src/splat/werewolf.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
   --> cofd/lib/src/splat/werewolf.rs:616:38
    |
616 |         ModifierTarget::Attribute(attr) => *character.attributes().get(&attr) as i16,
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check failure on line 35 in cofd/lib/src/dice_pool.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
  --> cofd/lib/src/dice_pool.rs:35:27
   |
35 |             Self::Trait(trait_) => character.get_trait(trait_) as i16,
   |                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check failure on line 34 in cofd/lib/src/dice_pool.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
  --> cofd/lib/src/dice_pool.rs:34:26
   |
34 |             Self::Skill(skill) => character.skills().get(*skill) as i16,
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check failure on line 33 in cofd/lib/src/dice_pool.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
  --> cofd/lib/src/dice_pool.rs:33:29
   |
33 |             Self::Attribute(attr) => *character.attributes().get(attr) as i16,
   |                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check warning on line 639 in cofd/lib/src/character/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&String` instead of `&str` involves a new object where a slice will do

warning: writing `&String` instead of `&str` involves a new object where a slice will do
   --> cofd/lib/src/character/mod.rs:639:18
    |
639 | fn is_empty(str: &String) -> bool {
    |                  ^^^^^^^ help: change this to: `&str`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg

Check failure on line 563 in cofd/lib/src/character/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i16` to `u16` may lose the sign of the value

error: casting `i16` to `u16` may lose the sign of the value
   --> cofd/lib/src/character/mod.rs:563:3
    |
563 |         max::<i16>(0, self.get_pool(Trait::Defense).unwrap().value(self)) as u16
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
    = note: `#[deny(clippy::cast_sign_loss)]` implied by `#[deny(clippy::pedantic)]`

Check failure on line 562 in cofd/lib/src/character/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/mod.rs:562:2
    |
562 |     pub fn defense(&self) -> u16 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> cofd/lib/src/character/mod.rs:563:17
    |
563 |         max::<i16>(0, self.get_pool(Trait::Defense).unwrap().value(self)) as u16
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check warning on line 281 in cofd/lib/src/character/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

writing `&Vec` instead of `&[_]` involves a new object where a slice will do

warning: writing `&Vec` instead of `&[_]` involves a new object where a slice will do
   --> cofd/lib/src/character/mod.rs:281:26
    |
281 | pub fn is_empty_vec(vec: &Vec<String>) -> bool {
    |                          ^^^^^^^^^^^^ help: change this to: `&[String]`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_arg
    = note: `#[warn(clippy::ptr_arg)]` on by default

Check failure on line 410 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/modifier.rs:406:2
    |
406 | /     pub fn get_conditional_pool(
407 | |         &self,
408 | |         target: impl Into<ModifierTarget>,
409 | |         condition: impl Into<Condition>,
410 | |     ) -> Option<DicePool> {
    | |_________________________^
    |
note: first possible panic found here
   --> cofd/lib/src/character/modifier.rs:411:22
    |
411 |         let modifier_map = self.modifier_map.read().unwrap();
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check failure on line 366 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/modifier.rs:362:2
    |
362 | /     pub fn get_pool(
363 | |         &self,
364 | |         character: &Character,
365 | |         target: impl Into<ModifierTarget>,
366 | |     ) -> Option<DicePool> {
    | |_________________________^
    |
note: first possible panic found here
   --> cofd/lib/src/character/modifier.rs:367:22
    |
367 |         let modifier_map = self.modifier_map.read().unwrap();
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check failure on line 351 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/modifier.rs:346:2
    |
346 | /     pub fn get_conditional_modifier(
347 | |         &self,
348 | |         character: &Character,
349 | |         target: impl Into<ModifierTarget>,
350 | |         condition: impl Into<Condition>,
351 | |     ) -> Option<i16> {
    | |____________________^
    |
note: first possible panic found here
   --> cofd/lib/src/character/modifier.rs:355:34
    |
355 |         let conditional_modifier_map = self.conditional_modifier_map.read().unwrap();
    |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check failure on line 321 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/modifier.rs:321:2
    |
321 |     pub fn get_modifier(&self, character: &Character, target: impl Into<ModifierTarget>) -> i16 {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> cofd/lib/src/character/modifier.rs:325:22
    |
325 |         let modifier_map = self.modifier_map.read().unwrap();
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc

Check failure on line 219 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

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

error: docs for function which may panic missing `# Panics` section
   --> cofd/lib/src/character/modifier.rs:219:2
    |
219 |     pub fn update(&self, character: &Character) {
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
note: first possible panic found here
   --> cofd/lib/src/character/modifier.rs:220:38
    |
220 |         let mut conditional_modifier_map = self.conditional_modifier_map.write().unwrap();
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_panics_doc
    = note: `#[deny(clippy::missing_panics_doc)]` implied by `#[deny(clippy::pedantic)]`

Check failure on line 121 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `i32` to `i16` may truncate the value

error: casting `i32` to `i16` may truncate the value
   --> cofd/lib/src/character/modifier.rs:121:22
    |
121 |         ModifierValue::Num(value as i16)
    |                            ^^^^^^^^^^^^
    |
    = help: if this is intentional allow the lint with `#[allow(clippy::cast_possible_truncation)]` ...
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_truncation
    = note: `#[deny(clippy::cast_possible_truncation)]` implied by `#[deny(clippy::pedantic)]`
help: ... or use `try_from` and handle the error accordingly
    |
121 |         ModifierValue::Num(i16::try_from(value))
    |                            ~~~~~~~~~~~~~~~~~~~~

Check failure on line 115 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
   --> cofd/lib/src/character/modifier.rs:115:22
    |
115 |         ModifierValue::Num(value as i16)
    |                            ^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check failure on line 101 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
   --> cofd/lib/src/character/modifier.rs:101:35
    |
101 |             ModifierValue::Skill(skill) => character.skills.get(*skill) as i16,
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap

Check failure on line 99 in cofd/lib/src/character/modifier.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

casting `u16` to `i16` may wrap around the value

error: casting `u16` to `i16` may wrap around the value
  --> cofd/lib/src/character/modifier.rs:99:5
   |
99 |                 *character.get_ability_value(ability).unwrap_or(&0) as i16
   |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_possible_wrap
note: the lint level is defined here
  --> cofd/lib/src/lib.rs:2:9
   |
2  | #![deny(clippy::pedantic)]
   |         ^^^^^^^^^^^^^^^^
   = note: `#[deny(clippy::cast_possible_wrap)]` implied by `#[deny(clippy::pedantic)]`

Check warning on line 678 in cofd/lib/src/splat/werewolf.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

function `form_pool` is never used

warning: function `form_pool` is never used
   --> cofd/lib/src/splat/werewolf.rs:678:4
    |
678 | fn form_pool(
    |    ^^^^^^^^^

Check warning on line 310 in cofd/lib/src/splat/vampire.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused variable: `value`

warning: unused variable: `value`
   --> cofd/lib/src/splat/vampire.rs:310:30
    |
310 |     pub fn get_modifiers(&self, value: u16) -> Vec<Modifier> {
    |                                 ^^^^^ help: if this is intentional, prefix it with an underscore: `_value`
    |
    = note: `#[warn(unused_variables)]` on by default

Check warning on line 7 in cofd/lib/src/splat/changeling.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

the item `Character` is imported redundantly

warning: the item `Character` is imported redundantly
 --> cofd/lib/src/splat/changeling.rs:7:3
  |
7 |         Character, Damage,
  |         ^^^^^^^^^
8 |     },
9 |     prelude::*,
  |     ---------- the item `Character` is already imported here

Check warning on line 11 in cofd/lib/src/splat/merits.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `Character`

warning: unused import: `Character`
  --> cofd/lib/src/splat/merits.rs:11:24
   |
11 |     prelude::{Attributes, Character, Skill, Skills, Trait},
   |                           ^^^^^^^^^

Check warning on line 7 in cofd/lib/src/splat/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused imports: `Attributes`, `Character`, `ModifierOp`, `ModifierTarget`, `ModifierValue`, `Modifier`, `Skills`, `Trait`

warning: unused imports: `Attributes`, `Character`, `ModifierOp`, `ModifierTarget`, `ModifierValue`, `Modifier`, `Skills`, `Trait`
 --> cofd/lib/src/splat/mod.rs:7:24
  |
7 |     character::modifier::{Modifier, ModifierOp, ModifierTarget, ModifierValue},
  |                           ^^^^^^^^  ^^^^^^^^^^  ^^^^^^^^^^^^^^  ^^^^^^^^^^^^^
8 |     character::traits::AttributeType,
9 |     prelude::{Attribute, Attributes, Character, Skill, Skills, Trait},
  |                          ^^^^^^^^^^  ^^^^^^^^^         ^^^^^^  ^^^^^

Check warning on line 5 in cofd/lib/src/character/mod.rs

See this annotation in the file changed.

@github-actions github-actions / clippy

unused import: `Index`

warning: unused import: `Index`
 --> cofd/lib/src/character/mod.rs:5:13
  |
5 |     ops::{Add, Index, Sub},
  |                ^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default