Skip to content

fix(instrument): retrigger on special 255 instrument

Sign in for the full log view
GitHub Actions / clippy failed Oct 5, 2024 in 1s

clippy

1 error, 58 warnings

Details

Results

Message level Amount
Internal compiler error 0
Error 1
Warning 58
Note 0
Help 0

Versions

  • rustc 1.83.0-nightly (14f303bc1 2024-10-04)
  • cargo 1.83.0-nightly (80d82ca22 2024-09-27)
  • clippy 0.1.83 (14f303b 2024-10-04)

Annotations

Check warning on line 249 in engine/src/asset/sound/sample.rs

@github-actions github-actions / clippy

casting `f32` to `usize` may lose the sign of the value

warning: casting `f32` to `usize` may lose the sign of the value
   --> engine/src/asset/sound/sample.rs:249:41
    |
249 | ...                   let index = frac.floor() as usize;
    |                                   ^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

Check warning on line 243 in engine/src/asset/sound/sample.rs

@github-actions github-actions / clippy

casting `f32` to `usize` may lose the sign of the value

warning: casting `f32` to `usize` may lose the sign of the value
   --> engine/src/asset/sound/sample.rs:243:34
    |
243 | ...                   self[(i_sample as f32 / factor).floor() as usize][i_channel]
    |                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

Check warning on line 236 in engine/src/asset/sound/sample.rs

@github-actions github-actions / clippy

casting `f32` to `usize` may lose the sign of the value

warning: casting `f32` to `usize` may lose the sign of the value
   --> engine/src/asset/sound/sample.rs:236:19
    |
236 |         let len = (self.len() as f32 * factor).round() as usize;
    |                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

Check warning on line 162 in engine/src/asset/sound/sample.rs

@github-actions github-actions / clippy

casting `f64` to `usize` may lose the sign of the value

warning: casting `f64` to `usize` may lose the sign of the value
   --> engine/src/asset/sound/sample.rs:162:9
    |
162 |         (time * self.sample_rate as f64) as usize
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

Check warning on line 436 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> engine/src/asset/sound/dat/mixer_new.rs:436:29
    |
436 | ...                   channel.pos_sample = sample.data.len_seconds() as f64
    |                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `channel.pos_sample = sample.data.len_seconds() as f64;`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 449 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:449:21
    |
449 |                     E::Porta(Porta::Slide { .. }) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
449 |                     E::Porta(Porta::Slide { .. }) | E::Dummy(..) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
451 -                     E::Dummy(..) => {}
    |

Check warning on line 448 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:448:21
    |
448 |                     E::Porta(Porta::Tone(..)) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
448 |                     E::Porta(Porta::Tone(..)) | E::Dummy(..) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
451 -                     E::Dummy(..) => {}
    |

Check warning on line 447 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:447:21
    |
447 |                     E::Volume(Volume::Slide(..)) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
447 |                     E::Volume(Volume::Slide(..)) | E::Dummy(..) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
451 -                     E::Dummy(..) => {}
    |

Check warning on line 448 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:448:21
    |
448 |                     E::Porta(Porta::Tone(..)) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
448 |                     E::Porta(Porta::Tone(..)) | E::Porta(Porta::Slide { .. }) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
449 -                     E::Porta(Porta::Slide { .. }) => {}
    |

Check warning on line 447 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:447:21
    |
447 |                     E::Volume(Volume::Slide(..)) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
447 |                     E::Volume(Volume::Slide(..)) | E::Porta(Porta::Slide { .. }) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
449 -                     E::Porta(Porta::Slide { .. }) => {}
    |

Check warning on line 447 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:447:21
    |
447 |                     E::Volume(Volume::Slide(..)) => {}
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
447 |                     E::Volume(Volume::Slide(..)) | E::Porta(Porta::Tone(..)) => {}
    |                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
    |
448 -                     E::Porta(Porta::Tone(..)) => {}
    |

Check warning on line 402 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

using `clone` on type `PatternEffect` which implements the `Copy` trait

warning: using `clone` on type `PatternEffect` which implements the `Copy` trait
   --> engine/src/asset/sound/dat/mixer_new.rs:402:42
    |
402 |                 channel.change_effect(i, effect.clone());
    |                                          ^^^^^^^^^^^^^^ help: try removing the `clone` call: `effect`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 404 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

adding items after statements is confusing, since items exist from the start of the scope

warning: adding items after statements is confusing, since items exist from the start of the scope
   --> engine/src/asset/sound/dat/mixer_new.rs:404:17
    |
404 |                 use PatternEffect as E;
    |                 ^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#items_after_statements
    = note: `#[warn(clippy::items_after_statements)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 393 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

using `clone` on type `PatternEventVolume` which implements the `Copy` trait

warning: using `clone` on type `PatternEventVolume` which implements the `Copy` trait
   --> engine/src/asset/sound/dat/mixer_new.rs:393:39
    |
393 |                 channel.change_volume(volume.clone());
    |                                       ^^^^^^^^^^^^^^ help: try dereferencing it: `*volume`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy

Check warning on line 389 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

using `clone` on type `PatternEventNote` which implements the `Copy` trait

warning: using `clone` on type `PatternEventNote` which implements the `Copy` trait
   --> engine/src/asset/sound/dat/mixer_new.rs:389:37
    |
389 |                 channel.change_note(note.clone());
    |                                     ^^^^^^^^^^^^ help: try dereferencing it: `*note`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default

Check warning on line 341 in engine/src/asset/sound/dat/mixer_new.rs

@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
   --> engine/src/asset/sound/dat/mixer_new.rs:334:21
    |
334 | /                     E::Volume(Volume::Set(..))
335 | |                     | E::Volume(Volume::Bump { .. })
336 | |                     | E::Porta(Porta::Tone(..))
337 | |                     | E::Porta(Porta::Bump { .. })
...   |
340 | |                     | E::SampleOffset(..)
341 | |                     | E::PlaybackDirection(..) => {}
    | |____________________________________________________^
    |
    = help: try changing either arm body
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
help: or try merging the arm patterns
    |
334 ~                     E::Volume(Volume::Set(..))
335 +                     | E::Volume(Volume::Bump { .. })
336 +                     | E::Porta(Porta::Tone(..))
337 +                     | E::Porta(Porta::Bump { .. })
338 +                     | E::Speed(..)
339 +                     | E::GlobalVolume(..)
340 +                     | E::SampleOffset(..)
341 ~                     | E::PlaybackDirection(..) | E::Dummy(..) => {}
    |
help: and remove this obsolete arm
    |
343 -                     E::Dummy(..) => {}
    |

Check warning on line 295 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

it is more concise to loop over references to containers instead of using explicit iteration methods

warning: it is more concise to loop over references to containers instead of using explicit iteration methods
   --> engine/src/asset/sound/dat/mixer_new.rs:295:24
    |
295 |         for channel in self.channels.iter_mut() {
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&mut self.channels`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
    = note: `#[warn(clippy::explicit_iter_loop)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 225 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

this boolean expression can be simplified

warning: this boolean expression can be simplified
   --> engine/src/asset/sound/dat/mixer_new.rs:219:16
    |
219 |               if (self.note.on
    |  ________________^
220 | |                 && if let Some(sustain) = envelope.sustain {
221 | |                     self.pos_volume_envelope < sustain
222 | |                 } else {
223 | |                     true
224 | |                 })
225 | |                 || !self.note.on
    | |________________________________^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#nonminimal_bool
    = note: `#[warn(clippy::nonminimal_bool)]` on by default
help: try
    |
219 ~             if !(self.note.on && !if let Some(sustain) = envelope.sustain {
220 +                     self.pos_volume_envelope < sustain
221 +                 } else {
222 +                     true
223 +                 })
    |
219 ~             if !self.note.on || if let Some(sustain) = envelope.sustain {
220 +                     self.pos_volume_envelope < sustain
221 +                 } else {
222 +                     true
223 +                 }
    |

Check warning on line 178 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

casting `i32` to `usize` may lose the sign of the value

warning: casting `i32` to `usize` may lose the sign of the value
   --> engine/src/asset/sound/dat/mixer_new.rs:178:54
    |
178 |                     self.sample = instrument.samples[note.note() as usize].clone();
    |                                                      ^^^^^^^^^^^^^^^^^^^^
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss

Check warning on line 178 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

assigning the result of `Clone::clone()` may be inefficient

warning: assigning the result of `Clone::clone()` may be inefficient
   --> engine/src/asset/sound/dat/mixer_new.rs:178:21
    |
178 |                     self.sample = instrument.samples[note.note() as usize].clone();
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use `clone_from()`: `self.sample.clone_from(&instrument.samples[note.note() as usize])`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assigning_clones
    = note: `#[warn(clippy::assigning_clones)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 132 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting
   --> engine/src/asset/sound/dat/mixer_new.rs:132:17
    |
132 |                 self.previous = None
    |                 ^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.previous = None;`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned

Check warning on line 114 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

used `cloned` where `copied` could be used instead

warning: used `cloned` where `copied` could be used instead
   --> engine/src/asset/sound/dat/mixer_new.rs:114:30
    |
114 | ...                   .cloned()
    |                        ^^^^^^ help: try: `copied`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied

Check warning on line 106 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

used `cloned` where `copied` could be used instead

warning: used `cloned` where `copied` could be used instead
   --> engine/src/asset/sound/dat/mixer_new.rs:106:30
    |
106 | ...                   .cloned()
    |                        ^^^^^^ help: try: `copied`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
    = note: `#[warn(clippy::cloned_instead_of_copied)]` implied by `#[warn(clippy::pedantic)]`

Check warning on line 15 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

methods called `into_*` usually take `self` by value

warning: methods called `into_*` usually take `self` by value
  --> engine/src/asset/sound/dat/mixer_new.rs:15:19
   |
15 |     fn into_bytes(&self) -> Self::Bytes;
   |                   ^^^^^
   |
   = help: consider choosing a less ambiguous name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention

Check warning on line 13 in engine/src/asset/sound/dat/mixer_new.rs

@github-actions github-actions / clippy

methods called `into_*` usually take `self` by value

warning: methods called `into_*` usually take `self` by value
  --> engine/src/asset/sound/dat/mixer_new.rs:13:28
   |
13 |     fn into_normalized_f32(&self) -> f32;
   |                            ^^^^^
   |
   = help: consider choosing a less ambiguous name
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#wrong_self_convention
   = note: `#[warn(clippy::wrong_self_convention)]` on by default