Feat/better mixer #188
check.yml
on: pull_request
nightly / fmt
14s
nightly / doc
30s
ubuntu / nightly / features
30s
Matrix: clippy
Annotations
20 warnings
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L239
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:239:41
|
239 | ... 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#L233
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:233:34
|
233 | ... 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#L226
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:226:19
|
226 | 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#L151
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:151:9
|
151 | (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#L286
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/t_instrument.rs:286:9
|
286 | / if self.loop_length != 0.0 {
287 | | &self.data[self.data.len_seconds() - self.loop_length..]
288 | | } else {
289 | | &[]
290 | | }
| |_________^
|
= 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#L269
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> engine/src/asset/sound/dat/t_instrument.rs:269:30
|
269 | ... .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#L255
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:255:35
|
255 | 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#L245
warning: called `map(<f>).unwrap_or(<a>)` on an `Option` value
--> engine/src/asset/sound/dat/mixer.rs:245:21
|
245 | / envelope
246 | | .get(self.volume_evelope_position)
247 | | .map(ToOwned::to_owned)
248 | | .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
|
247 - .map(ToOwned::to_owned)
247 + .map_or(default, ToOwned::to_owned)
|
|
casting `i32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L227
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:227:37
|
227 | &instrument.samples[note.finetune.note() 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#L135
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/mixer.rs:135:43
|
135 | let tick_length = if (j + 1) != speed {
| ___________________________________________^
136 | | tick_length
137 | | } else {
138 | | sample_length - j * tick_length
139 | | };
| |_________________________^
|
= 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#L124
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:124:37
|
124 | 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)]`
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
engine/src/asset/sound/dat/mixer.rs#L111
warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
--> engine/src/asset/sound/dat/mixer.rs:111:25
|
111 | / match effect {
112 | | PatternEffect::Volume(Volume::Slide(Some(volume))) => {
113 | | channel.volume += volume;
114 | | }
115 | | _ => {}
116 | | }
| |_________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#single_match
= note: `#[warn(clippy::single_match)]` on by default
help: try
|
111 ~ if let PatternEffect::Volume(Volume::Slide(Some(volume))) = effect {
112 + channel.volume += volume;
113 + }
|
|
consider adding a `;` to the last statement for consistent formatting:
engine/src/asset/sound/dat/mixer.rs#L99
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer.rs:99:33
|
99 | ... channel.playback_direaction = direction
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `channel.playback_direaction = direction;`
|
= 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)]`
|
this match arm has an identical body to the `_` wildcard arm:
engine/src/asset/sound/dat/mixer.rs#L85
warning: this match arm has an identical body to the `_` wildcard arm
--> engine/src/asset/sound/dat/mixer.rs:85:29
|
85 | ... 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:105:29
|
105 | ... _ => {}
| ^^^^^^^
= 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)]`
|
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: the lint level is defined here
--> engine/src/lib.rs:1:9
|
1 | #![warn(clippy::pedantic)]
| ^^^^^^^^^^^^^^^^
= note: `#[warn(clippy::missing_panics_doc)]` implied by `#[warn(clippy::pedantic)]`
|
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/
|