Feat/better mixer #192
check.yml
on: pull_request
nightly / fmt
14s
nightly / doc
27s
ubuntu / nightly / features
29s
Matrix: clippy
Annotations
3 errors and 24 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#L240
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:240:41
|
240 | ... 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#L234
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:234:34
|
234 | ... 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#L227
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:227:19
|
227 | 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 `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L154
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:154:9
|
154 | (time * self.sample_rate as f32) as usize
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#cast_sign_loss
|
unnecessary `!=` operation:
engine/src/asset/sound/dat/t_instrument.rs#L284
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/t_instrument.rs:284:9
|
284 | / if self.loop_length != 0.0 {
285 | | &self.data[self.data.len_seconds() - self.loop_length..]
286 | | } else {
287 | | &[]
288 | | }
| |_________^
|
= 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
|
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`:
engine/src/asset/sound/dat/t_instrument.rs#L267
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> engine/src/asset/sound/dat/t_instrument.rs:267:30
|
267 | ... .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
|
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#L312
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:312:35
|
312 | 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
|
called `map(<f>).unwrap_or(<a>)` on an `Option` value:
engine/src/asset/sound/dat/mixer.rs#L302
warning: called `map(<f>).unwrap_or(<a>)` on an `Option` value
--> engine/src/asset/sound/dat/mixer.rs:302:21
|
302 | / envelope
303 | | .get(self.volume_envelope_position)
304 | | .map(ToOwned::to_owned)
305 | | .unwrap_or(default)
| |___________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#map_unwrap_or
= note: `#[warn(clippy::map_unwrap_or)]` implied by `#[warn(clippy::pedantic)]`
help: use `map_or(<a>, <f>)` instead
|
304 - .map(ToOwned::to_owned)
304 + .map_or(default, ToOwned::to_owned)
|
|
casting `i32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L282
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:282:37
|
282 | &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
|
unnecessary `!=` operation:
engine/src/asset/sound/dat/mixer.rs#L186
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/mixer.rs:186:43
|
186 | let tick_length = if (j + 1) != speed {
| ___________________________________________^
187 | | tick_length
188 | | } else {
189 | | sample_length - j * tick_length
190 | | };
| |_________________________^
|
= 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#L180
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:180:37
|
180 | 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#L114
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer.rs:114:33
|
114 | ... 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#L86
warning: this match arm has an identical body to the `_` wildcard arm
--> engine/src/asset/sound/dat/mixer.rs:86:29
|
86 | ... PatternEffect::Dummy(_) => {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the arm
|
= help: or try changing either arm body
note: `_` wildcard arm here
--> engine/src/asset/sound/dat/mixer.rs:137:29
|
137 | ... _ => {}
| ^^^^^^^
= 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#L35
warning: this function has too many lines (148/100)
--> engine/src/asset/sound/dat/mixer.rs:35:5
|
35 | / fn mix(&self, start: usize) -> Sample<i16, 1> {
36 | | let mut song = Sample::mono(Self::SAMPLE_RATE);
37 | |
38 | | let mut channels: Vec<_> = (0..self.patterns[0][0].len())
... |
202 | | song
203 | | }
| |_____^
|
= 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/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#L129
warning: unnested or-patterns
--> engine/src/asset/sound/dat/mixer.rs:129:29
|
129 | / ... PatternEffect::Porta(Porta::Tone(None))
130 | | ... | PatternEffect::Porta(Porta::Slide { finetune: None, .. })
131 | | ... | PatternEffect::Porta(Porta::Bump { finetune: None, .. })
132 | | ... | PatternEffect::Volume(Volume::Slide(None))
133 | | ... | PatternEffect::Volume(Volume::Bump { volume: None, .. })
134 | | ... | 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
|
129 ~ PatternEffect::Porta(Porta::Tone(None) | Porta::Slide { finetune: None, .. } |
130 + Porta::Bump { finetune: None, .. }) |
131 + PatternEffect::Volume(Volume::Slide(None) | Volume::Bump { volume: None, .. })
132 ~ | PatternEffect::SampleOffset(None) => {
|
|
nightly / clippy
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions-rs/clippy-check@v1. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
|
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/
|