Feat/better mixer #206
check.yml
on: pull_request
nightly / fmt
13s
nightly / doc
30s
ubuntu / nightly / features
34s
Matrix: clippy
Annotations
3 errors and 59 warnings
nightly / fmt
Process completed with exit code 1.
|
you are deriving `Ord` but have implemented `PartialOrd` explicitly:
engine/src/asset/sound/dat/finetune.rs#L3
error: you are deriving `Ord` but have implemented `PartialOrd` explicitly
--> engine/src/asset/sound/dat/finetune.rs:3:45
|
3 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Ord)]
| ^^^
|
note: `PartialOrd` implemented here
--> engine/src/asset/sound/dat/finetune.rs:71:1
|
71 | impl PartialOrd for FineTune {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#derive_ord_xor_partial_ord
= note: `#[deny(clippy::derive_ord_xor_partial_ord)]` on by default
= note: this error originates in the derive macro `Ord` (in Nightly builds, run with -Z macro-backtrace for more info)
|
nightly / clippy
Clippy had exited with the 101 exit code
|
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L249
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
|
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L243
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
|
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L236
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
|
casting `f64` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L162
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
|
consider adding a `;` to the last statement for consistent formatting:
engine/src/asset/sound/dat/mixer_new.rs#L428
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer_new.rs:428:33
|
428 | ... 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
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L438
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:438:25
|
438 | 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
|
438 | E::Porta(Porta::Slide { .. }) | E::Dummy(..) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
440 - E::Dummy(..) => {}
|
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L437
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:437:25
|
437 | 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
|
437 | E::Porta(Porta::Tone(..)) | E::Dummy(..) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
440 - E::Dummy(..) => {}
|
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L436
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:436:25
|
436 | 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
|
436 | E::Volume(Volume::Slide(..)) | E::Dummy(..) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
440 - E::Dummy(..) => {}
|
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L437
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:437:25
|
437 | 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
|
437 | E::Porta(Porta::Tone(..)) | E::Porta(Porta::Slide { .. }) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
438 - E::Porta(Porta::Slide { .. }) => {}
|
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L436
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:436:25
|
436 | 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
|
436 | E::Volume(Volume::Slide(..)) | E::Porta(Porta::Slide { .. }) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
438 - E::Porta(Porta::Slide { .. }) => {}
|
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L436
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:436:25
|
436 | 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
|
436 | E::Volume(Volume::Slide(..)) | E::Porta(Porta::Tone(..)) => {}
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
help: and remove this obsolete arm
|
437 - E::Porta(Porta::Tone(..)) => {}
|
|
using `clone` on type `PatternEffect` which implements the `Copy` trait:
engine/src/asset/sound/dat/mixer_new.rs#L394
warning: using `clone` on type `PatternEffect` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:394:46
|
394 | channel.change_effect(i, effect.clone());
| ^^^^^^^^^^^^^^ help: try dereferencing it: `*effect`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
|
adding items after statements is confusing, since items exist from the start of the scope:
engine/src/asset/sound/dat/mixer_new.rs#L396
warning: adding items after statements is confusing, since items exist from the start of the scope
--> engine/src/asset/sound/dat/mixer_new.rs:396:21
|
396 | 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)]`
|
using `clone` on type `PatternEventVolume` which implements the `Copy` trait:
engine/src/asset/sound/dat/mixer_new.rs#L389
warning: using `clone` on type `PatternEventVolume` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:389:39
|
389 | 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
|
using `clone` on type `PatternEventNote` which implements the `Copy` trait:
engine/src/asset/sound/dat/mixer_new.rs#L385
warning: using `clone` on type `PatternEventNote` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:385:37
|
385 | 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
|
this match arm has an identical body to another arm:
engine/src/asset/sound/dat/mixer_new.rs#L329
warning: this match arm has an identical body to another arm
--> engine/src/asset/sound/dat/mixer_new.rs:329:25
|
329 | / E::Volume(Volume::Set(..))
330 | | | E::Volume(Volume::Bump { .. })
331 | | | E::Porta(Porta::Tone(..))
332 | | | E::Porta(Porta::Bump { .. })
... |
335 | | | E::SampleOffset(..)
336 | | | 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
|
329 ~ E::Volume(Volume::Set(..))
330 + | E::Volume(Volume::Bump { .. })
331 + | E::Porta(Porta::Tone(..))
332 + | E::Porta(Porta::Bump { .. })
333 + | E::Speed(..)
334 + | E::GlobalVolume(..)
335 + | E::SampleOffset(..)
336 ~ | E::PlaybackDirection(..) | E::Dummy(..) => {}
|
help: and remove this obsolete arm
|
338 - E::Dummy(..) => {}
|
|
unnecessary `if let` since only the `Some` variant of the iterator element is used:
engine/src/asset/sound/dat/mixer_new.rs#L296
warning: unnecessary `if let` since only the `Some` variant of the iterator element is used
--> engine/src/asset/sound/dat/mixer_new.rs:296:13
|
296 | for effect in channel.effects.iter() {
| ^ ---------------------- help: try: `channel.effects.iter().flatten()`
| _____________|
| |
297 | | if let Some(effect) = effect {
298 | | use PatternEffect as E;
299 | | match *effect {
... |
345 | | }
346 | | }
| |_____________^
|
help: ...and remove the `if let` statement in the for loop
--> engine/src/asset/sound/dat/mixer_new.rs:297:17
|
297 | / if let Some(effect) = effect {
298 | | use PatternEffect as E;
299 | | match *effect {
300 | | // Tick effects
... |
344 | | }
345 | | }
| |_________________^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_flatten
= note: `#[warn(clippy::manual_flatten)]` on by default
|
it is more concise to loop over references to containers instead of using explicit iteration methods:
engine/src/asset/sound/dat/mixer_new.rs#L296
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:296:27
|
296 | for effect in channel.effects.iter() {
| ^^^^^^^^^^^^^^^^^^^^^^ help: to write this more concisely, try: `&channel.effects`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#explicit_iter_loop
|
it is more concise to loop over references to containers instead of using explicit iteration methods:
engine/src/asset/sound/dat/mixer_new.rs#L293
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:293:24
|
293 | 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)]`
|
this boolean expression can be simplified:
engine/src/asset/sound/dat/mixer_new.rs#L217
warning: this boolean expression can be simplified
--> engine/src/asset/sound/dat/mixer_new.rs:217:16
|
217 | if (self.note.on
| ________________^
218 | | && if let Some(sustain) = envelope.sustain {
219 | | self.pos_volume_envelope < sustain
220 | | } else {
221 | | true
222 | | })
223 | | || !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
|
217 ~ if !(self.note.on && !if let Some(sustain) = envelope.sustain {
218 + self.pos_volume_envelope < sustain
219 + } else {
220 + true
221 + })
|
217 ~ if !self.note.on || if let Some(sustain) = envelope.sustain {
218 + self.pos_volume_envelope < sustain
219 + } else {
220 + true
221 + }
|
|
casting `i32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer_new.rs#L176
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer_new.rs:176:54
|
176 | 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
|
assigning the result of `Clone::clone()` may be inefficient:
engine/src/asset/sound/dat/mixer_new.rs#L176
warning: assigning the result of `Clone::clone()` may be inefficient
--> engine/src/asset/sound/dat/mixer_new.rs:176:21
|
176 | 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)]`
|
consider adding a `;` to the last statement for consistent formatting:
engine/src/asset/sound/dat/mixer_new.rs#L138
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer_new.rs:138:17
|
138 | 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
|
used `cloned` where `copied` could be used instead:
engine/src/asset/sound/dat/mixer_new.rs#L119
warning: used `cloned` where `copied` could be used instead
--> engine/src/asset/sound/dat/mixer_new.rs:119:34
|
119 | ... .cloned()
| ^^^^^^ help: try: `copied`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cloned_instead_of_copied
|
used `cloned` where `copied` could be used instead:
engine/src/asset/sound/dat/mixer_new.rs#L111
warning: used `cloned` where `copied` could be used instead
--> engine/src/asset/sound/dat/mixer_new.rs:111:34
|
111 | ... .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)]`
|
methods called `into_*` usually take `self` by value:
engine/src/asset/sound/dat/mixer_new.rs#L15
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
|
methods called `into_*` usually take `self` by value:
engine/src/asset/sound/dat/mixer_new.rs#L13
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
|
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`:
engine/src/asset/sound/dat/t_song.rs#L63
warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> engine/src/asset/sound/dat/t_song.rs:63:41
|
63 | / ... event.instrument.as_ref().map(|instrument| {
64 | | ... d.field_with("instrument", |f| match instrument {
65 | | ... None => f.write_fmt(format_args!("None")),
66 | | ... Some(instrument) => f.write_fmt(format_args!(
... |
73 | | ... });
74 | | ... });
| |________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
help: try
|
63 ~ if let Some(instrument) = event.instrument.as_ref() { d.field_with("instrument", |f| match instrument {
64 + None => f.write_fmt(format_args!("None")),
65 + Some(instrument) => f.write_fmt(format_args!(
66 + "Some({})",
67 + self.instruments
68 + .iter()
69 + .position(|i| Rc::ptr_eq(i, instrument))
70 + .unwrap()
71 + )),
72 + }); }
|
|
variables can be used directly in the `format!` string:
engine/src/asset/sound/dat/t_song.rs#L60
warning: variables can be used directly in the `format!` string
--> engine/src/asset/sound/dat/t_song.rs:60:61
|
60 | ... f.write_fmt(format_args!("{:?}", volume))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
help: change this to
|
60 - f.write_fmt(format_args!("{:?}", volume))
60 + f.write_fmt(format_args!("{volume:?}"))
|
|
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`:
engine/src/asset/sound/dat/t_song.rs#L58
warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> engine/src/asset/sound/dat/t_song.rs:58:41
|
58 | / ... event.volume.map(|volume| {
59 | | ... d.field_with("volume", |f| {
60 | | ... f.write_fmt(format_args!("{:?}", volume))
61 | | ... });
62 | | ... });
| |________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
help: try
|
58 ~ if let Some(volume) = event.volume { d.field_with("volume", |f| {
59 + f.write_fmt(format_args!("{:?}", volume))
60 + }); }
|
|
variables can be used directly in the `format!` string:
engine/src/asset/sound/dat/t_song.rs#L55
warning: variables can be used directly in the `format!` string
--> engine/src/asset/sound/dat/t_song.rs:55:61
|
55 | ... f.write_fmt(format_args!("{:?}", note))
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#uninlined_format_args
= note: `#[warn(clippy::uninlined_format_args)]` implied by `#[warn(clippy::pedantic)]`
help: change this to
|
55 - f.write_fmt(format_args!("{:?}", note))
55 + f.write_fmt(format_args!("{note:?}"))
|
|
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`:
engine/src/asset/sound/dat/t_song.rs#L53
warning: called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
--> engine/src/asset/sound/dat/t_song.rs:53:41
|
53 | / ... event.note.map(|note| {
54 | | ... d.field_with("note", |f| {
55 | | ... f.write_fmt(format_args!("{:?}", note))
56 | | ... });
57 | | ... });
| |________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_map_unit_fn
= note: `#[warn(clippy::option_map_unit_fn)]` on by default
help: try
|
53 ~ if let Some(note) = event.note { d.field_with("note", |f| {
54 + f.write_fmt(format_args!("{:?}", note))
55 + }); }
|
|
redundant closure:
engine/src/asset/sound/dat/t_song.rs#L38
warning: redundant closure
--> engine/src/asset/sound/dat/t_song.rs:38:48
|
38 | ... if !row.iter().any(|c| c.has_content()) {
| ^^^^^^^^^^^^^^^^^^^ help: replace the closure with the method itself: `super::pattern_event::PatternEvent::has_content`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
= note: `#[warn(clippy::redundant_closure_for_method_calls)]` implied by `#[warn(clippy::pedantic)]`
|
manual `Debug` impl does not include all fields:
engine/src/asset/sound/dat/t_song.rs#L25
warning: manual `Debug` impl does not include all fields
--> engine/src/asset/sound/dat/t_song.rs:25:1
|
25 | / impl std::fmt::Debug for TSong {
26 | | fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
27 | | f.debug_struct("TSong")
28 | | .field("bpm", &self.bpm)
... |
92 | | }
93 | | }
| |_^
|
note: this field is unused
--> engine/src/asset/sound/dat/t_song.rs:20:5
|
20 | pub patterns: Vec<Rc<Pattern>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: this field is unused
--> engine/src/asset/sound/dat/t_song.rs:22:5
|
22 | pub samples: Vec<Rc<TSample>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= help: consider including all fields in this `Debug` impl
= help: consider calling `.finish_non_exhaustive()` if you intend to ignore fields
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#missing_fields_in_debug
= note: `#[warn(clippy::missing_fields_in_debug)]` implied by `#[warn(clippy::pedantic)]`
|
casting `f64` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/t_instrument.rs#L279
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/t_instrument.rs:279:41
|
279 | let Some(next) = self.normalize(position as usize + 1) else {
| ^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
|
casting `f64` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/t_instrument.rs#L276
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/t_instrument.rs:276:41
|
276 | let Some(prev) = self.normalize(position as usize) else {
| ^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
engine/src/asset/sound/dat/t_instrument.rs#L244
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> engine/src/asset/sound/dat/t_instrument.rs:244:30
|
244 | ... .into_iter()
| ^^^^^^^^^ help: call directly: `iter`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#into_iter_on_ref
= note: `#[warn(clippy::into_iter_on_ref)]` on by default
|
use of `expect` followed by a function call:
engine/src/asset/sound/dat/t_instrument.rs#L32
warning: use of `expect` followed by a function call
--> engine/src/asset/sound/dat/t_instrument.rs:32:52
|
32 | TInstrumentFlags::from_bits(flags).expect(&format!(
| ____________________________________________________^
33 | | "PatternEvent flags should be valid: received: {flags:b}"
34 | | )),
| |__________________^ help: try: `unwrap_or_else(|| panic!("PatternEvent flags should be valid: received: {flags:b}"))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
|
consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases:
engine/src/asset/sound/dat/pattern_event.rs#L131
warning: consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
--> engine/src/asset/sound/dat/pattern_event.rs:131:21
|
131 | pub instrument: Option<Option<Rc<TInstrument>>>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#option_option
= note: `#[warn(clippy::option_option)]` implied by `#[warn(clippy::pedantic)]`
|
use of `expect` followed by a function call:
engine/src/asset/sound/dat/pattern_event.rs#L66
warning: use of `expect` followed by a function call
--> engine/src/asset/sound/dat/pattern_event.rs:66:53
|
66 | PatternEventFlags::from_bits(flags).expect(&format!(
| _____________________________________________________^
67 | | "PatternEvent flags should be valid: received: {flags:b}"
68 | | )),
| |__________________^ help: try: `unwrap_or_else(|| panic!("PatternEvent flags should be valid: received: {flags:b}"))`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#expect_fun_call
= note: `#[warn(clippy::expect_fun_call)]` on by default
|
casting `f64` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L316
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:316:35
|
316 | let duration_scaled = (duration as f64 / pitch_factor).round() as usize;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
|
casting `i32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L284
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:284:55
|
284 | && let Some(sample) = &instrument.samples[note.finetune.note().clamp(0, 95) as usize]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
|
it is more idiomatic to use `Option<&T>` instead of `&Option<T>`:
engine/src/asset/sound/dat/mixer.rs#L260
warning: it is more idiomatic to use `Option<&T>` instead of `&Option<T>`
--> engine/src/asset/sound/dat/mixer.rs:260:5
|
260 | fn change_instrument(&mut self, instrument: &'a Option<Rc<TInstrument>>) {
| ^ --------------------------- help: change this to: `Option<&'a Rc<TInstrument>>`
| _____|
| |
261 | | self.instrument = Some(instrument);
262 | | self.sample_position = 0;
263 | | self.volume_envelope_position = 0;
264 | | self.playback_direction = PlaybackDirection::Forwards;
265 | | }
| |_____^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ref_option
= note: `#[warn(clippy::ref_option)]` implied by `#[warn(clippy::pedantic)]`
|
unnecessary `!=` operation:
engine/src/asset/sound/dat/mixer.rs#L188
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/mixer.rs:188:43
|
188 | let tick_length = if (j + 1) != speed {
| ___________________________________________^
189 | | tick_length
190 | | } else {
191 | | sample_length - j * tick_length
192 | | };
| |_________________________^
|
= help: change to `==` and swap the blocks of the `if`/`else`
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
= note: `#[warn(clippy::if_not_else)]` implied by `#[warn(clippy::pedantic)]`
|
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L182
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:182:37
|
182 | let sample_length = sample_length as usize;
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
= note: `#[warn(clippy::cast_sign_loss)]` implied by `#[warn(clippy::pedantic)]`
|
consider adding a `;` to the last statement for consistent formatting:
engine/src/asset/sound/dat/mixer.rs#L116
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer.rs:116:33
|
116 | ... channel.playback_direction = PlaybackDirection::Forwards
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `channel.playback_direction = PlaybackDirection::Forwards;`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
|
this match arm has an identical body to the `_` wildcard arm:
engine/src/asset/sound/dat/mixer.rs#L88
warning: this match arm has an identical body to the `_` wildcard arm
--> engine/src/asset/sound/dat/mixer.rs:88:29
|
88 | / ... PatternEffect::Dummy(_) => {}
89 | | ... PatternEffect::Speed(Speed::Bpm(s)) => {
| |______________________^ help: try removing the arm
|
= help: or try changing either arm body
note: `_` wildcard arm here
--> engine/src/asset/sound/dat/mixer.rs:139:29
|
139 | ... _ => {}
| ^^^^^^^
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_same_arms
= note: `#[warn(clippy::match_same_arms)]` implied by `#[warn(clippy::pedantic)]`
|
this function has too many lines (148/100):
engine/src/asset/sound/dat/mixer.rs#L37
warning: this function has too many lines (148/100)
--> engine/src/asset/sound/dat/mixer.rs:37:5
|
37 | / fn mix(&self, start: usize) -> Sample<i16, 1> {
38 | | let mut song = Sample::mono(Self::SAMPLE_RATE);
39 | |
40 | | let mut channels: Vec<_> = (0..self.patterns[0][0].len())
... |
204 | | song
205 | | }
| |_____^
|
= 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)]`
|
non-canonical implementation of `partial_cmp` on an `Ord` type:
engine/src/asset/sound/dat/finetune.rs#L71
warning: non-canonical implementation of `partial_cmp` on an `Ord` type
--> engine/src/asset/sound/dat/finetune.rs:71:1
|
71 | / impl PartialOrd for FineTune {
72 | | fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
| | _______________________________________________________________________-
73 | || self.cents.partial_cmp(&other.cents)
74 | || }
| ||_____- help: change this to: `{ Some(self.cmp(other)) }`
75 | | }
| |__^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#non_canonical_partial_ord_impl
= note: `#[warn(clippy::non_canonical_partial_ord_impl)]` on by default
|
consider adding a `;` to the last statement for consistent formatting:
engine/src/asset/sound/dat/finetune.rs#L51
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/finetune.rs:51:9
|
51 | self.cents = self.cents.saturating_add(rhs.cents)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.cents = self.cents.saturating_add(rhs.cents);`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
= note: `#[warn(clippy::semicolon_if_nothing_returned)]` implied by `#[warn(clippy::pedantic)]`
|
docs for function returning `Result` missing `# Errors` section:
engine/src/asset/pack_file.rs#L26
warning: docs for function returning `Result` missing `# Errors` section
--> engine/src/asset/pack_file.rs:26:5
|
26 | pub fn new(input: &[u8]) -> 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)]`
|
docs for function which may panic missing `# Panics` section:
engine/src/asset/color_map.rs#L18
warning: docs for function which may panic missing `# Panics` section
--> engine/src/asset/color_map.rs:18:5
|
18 | pub fn from_12_bit(color: u16) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
note: first possible panic found here
--> engine/src/asset/color_map.rs:20:9
|
20 | assert!(color <= 0xFFF, "12 bit color is smaller than 0xFFF");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= 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)]`
|
unnested or-patterns:
engine/src/asset/sound/dat/mixer_new.rs#L442
warning: unnested or-patterns
--> engine/src/asset/sound/dat/mixer_new.rs:442:25
|
442 | / E::Volume(Volume::Bump { volume: None, .. })
443 | | | E::Porta(Porta::Tone(None))
444 | | | E::Porta(Porta::Bump { finetune: None, .. })
445 | | | E::SampleOffset(None) => {
| |_______________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
|
442 ~ E::Volume(Volume::Bump { volume: None, .. }) |
443 + E::Porta(Porta::Tone(None) | Porta::Bump { finetune: None, .. }) |
444 ~ E::SampleOffset(None) => {
|
|
unnested or-patterns:
engine/src/asset/sound/dat/mixer_new.rs#L329
warning: unnested or-patterns
--> engine/src/asset/sound/dat/mixer_new.rs:329:25
|
329 | / E::Volume(Volume::Set(..))
330 | | | E::Volume(Volume::Bump { .. })
331 | | | E::Porta(Porta::Tone(..))
332 | | | E::Porta(Porta::Bump { .. })
... |
335 | | | E::SampleOffset(..)
336 | | | E::PlaybackDirection(..) => {}
| |__________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
|
329 ~ E::Volume(Volume::Set(..) | Volume::Bump { .. }) |
330 + E::Porta(Porta::Tone(..) | Porta::Bump { .. }) | E::Speed(..) |
331 ~ E::GlobalVolume(..) | E::SampleOffset(..) | E::PlaybackDirection(..) => {}
|
|
this `if` statement can be collapsed:
engine/src/asset/sound/dat/mixer_new.rs#L214
warning: this `if` statement can be collapsed
--> engine/src/asset/sound/dat/mixer_new.rs:214:9
|
214 | / if let Some(instrument) = &self.instrument
215 | | && let TInstrumentVolume::Envelope(envelope) = &instrument.volume
216 | | {
217 | | if (self.note.on
... |
226 | | }
227 | | }
| |_________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_if
= note: `#[warn(clippy::collapsible_if)]` on by default
help: collapse nested if block
|
214 ~ if let Some(instrument) = &self.instrument && let TInstrumentVolume::Envelope(envelope) = &instrument.volume && ((self.note.on
215 + && if let Some(sustain) = envelope.sustain {
216 + self.pos_volume_envelope < sustain
217 + } else {
218 + true
219 + }) || !self.note.on) {
220 + self.pos_volume_envelope += 1;
221 + }
|
|
unnested or-patterns:
engine/src/asset/sound/dat/pattern_effect.rs#L118
warning: unnested or-patterns
--> engine/src/asset/sound/dat/pattern_effect.rs:118:13
|
118 | / PatternEffect::Porta(Porta::Tone(None))
119 | | | PatternEffect::Porta(Porta::Slide { finetune: None, .. })
120 | | | PatternEffect::Porta(Porta::Bump { finetune: None, .. })
121 | | | PatternEffect::Volume(Volume::Slide(None))
122 | | | PatternEffect::Volume(Volume::Bump { volume: None, .. })
123 | | | PatternEffect::SampleOffset(None)
| |___________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
help: nest the patterns
|
118 ~ PatternEffect::Porta(Porta::Tone(None) | Porta::Slide { finetune: None, .. } |
119 + Porta::Bump { finetune: None, .. }) |
120 + PatternEffect::Volume(Volume::Slide(None) | Volume::Bump { volume: None, .. })
121 + | PatternEffect::SampleOffset(None)
|
|
unnested or-patterns:
engine/src/asset/sound/dat/mixer.rs#L131
warning: unnested or-patterns
--> engine/src/asset/sound/dat/mixer.rs:131:29
|
131 | / ... PatternEffect::Porta(Porta::Tone(None))
132 | | ... | PatternEffect::Porta(Porta::Slide { finetune: None, .. })
133 | | ... | PatternEffect::Porta(Porta::Bump { finetune: None, .. })
134 | | ... | PatternEffect::Volume(Volume::Slide(None))
135 | | ... | PatternEffect::Volume(Volume::Bump { volume: None, .. })
136 | | ... | PatternEffect::SampleOffset(None) => {
| |_________________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnested_or_patterns
note: the lint level is defined here
--> engine/src/lib.rs:1:9
|
1 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::unnested_or_patterns)]` implied by `#[warn(clippy::pedantic)]`
help: nest the patterns
|
131 ~ PatternEffect::Porta(Porta::Tone(None) | Porta::Slide { finetune: None, .. } |
132 + Porta::Bump { finetune: None, .. }) |
133 + PatternEffect::Volume(Volume::Slide(None) | Volume::Bump { volume: None, .. })
134 ~ | PatternEffect::SampleOffset(None) => {
|
|
nightly / clippy
The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/
|
nightly / clippy
The following actions use a deprecated Node.js version and will be forced to run on node20: actions-rs/clippy-check@v1. For more info: https://github.blog/changelog/2024-03-07-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
|