Feat/better mixer #186
check.yml
on: pull_request
nightly / fmt
12s
nightly / doc
27s
ubuntu / nightly / features
28s
Matrix: clippy
Annotations
22 warnings
casting `f32` to `usize` may lose the sign of the value:
engine/src/asset/sound/sample.rs#L241
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:241:41
|
241 | ... 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#L235
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/sample.rs:235:34
|
235 | ... 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
|
useless conversion to the same type: `std::ops::Range<usize>`:
engine/src/asset/sound/sample.rs#L231
warning: useless conversion to the same type: `std::ops::Range<usize>`
--> engine/src/asset/sound/sample.rs:231:17
|
231 | / (0..CHANNELS)
232 | | .into_iter()
| |________________________________^ help: consider removing `.into_iter()`: `(0..CHANNELS)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
|
useless conversion to the same type: `std::ops::Range<usize>`:
engine/src/asset/sound/sample.rs#L228
warning: useless conversion to the same type: `std::ops::Range<usize>`
--> engine/src/asset/sound/sample.rs:228:9
|
228 | / (0..len)
229 | | .into_iter()
| |________________________^ help: consider removing `.into_iter()`: `(0..len)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_conversion
= note: `#[warn(clippy::useless_conversion)]` on by default
|
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
|
you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>`:
engine/src/asset/sound/sample.rs#L81
warning: you seem to be trying to use `Box<Vec<..>>`. Consider using just `Vec<..>`
--> engine/src/asset/sound/sample.rs:81:15
|
81 | pub data: Box<Vec<[S; CHANNELS]>>,
| ^^^^^^^^^^^^^^^^^^^^^^^
|
= help: `Vec<..>` is already on the heap, `Box<Vec<..>>` makes an extra allocation
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#box_collection
= note: `#[warn(clippy::box_collection)]` on by default
|
unnecessary `!=` operation:
engine/src/asset/sound/dat/t_instrument.rs#L288
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/t_instrument.rs:288:9
|
288 | / if self.loop_length != 0.0 {
289 | | &self.data[self.data.len_seconds() - self.loop_length..]
290 | | } else {
291 | | &[]
292 | | }
| |_________^
|
= 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#L270
warning: this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
--> engine/src/asset/sound/dat/t_instrument.rs:270:34
|
270 | ... .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#L244
warning: casting `f64` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:244:35
|
244 | 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#L227
warning: called `map(<f>).unwrap_or(<a>)` on an `Option` value
--> engine/src/asset/sound/dat/mixer.rs:227:25
|
227 | / envelope
228 | | .volume_beginning()
229 | | .get(self.volume_evelope_position)
230 | | .map(ToOwned::to_owned)
231 | | .unwrap_or(envelope.volume_loop())
| |______________________________________________________________^
|
= 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
|
230 - .map(ToOwned::to_owned)
230 + .map_or(envelope.volume_loop(), ToOwned::to_owned)
|
|
casting `i32` to `usize` may lose the sign of the value:
engine/src/asset/sound/dat/mixer.rs#L213
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:213:37
|
213 | &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#L122
warning: unnecessary `!=` operation
--> engine/src/asset/sound/dat/mixer.rs:122:43
|
122 | let tick_length = if (j + 1) != speed {
| ___________________________________________^
123 | | tick_length
124 | | } else {
125 | | sample_length - j * tick_length
126 | | };
| |_________________________^
|
= 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#L111
warning: casting `f32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer.rs:111:37
|
111 | 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)]`
|
manual implementation of an assign operation:
engine/src/asset/sound/dat/mixer.rs#L100
warning: manual implementation of an assign operation
--> engine/src/asset/sound/dat/mixer.rs:100:33
|
100 | ... channel.volume = channel.volume + channel.volume_slide;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `channel.volume += channel.volume_slide`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#assign_op_pattern
= note: `#[warn(clippy::assign_op_pattern)]` on by default
|
you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`:
engine/src/asset/sound/dat/mixer.rs#L98
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:98:25
|
98 | / match effect {
99 | | PatternEffect::Volume(Volume::Slide(_)) => {
100 | | channel.volume = channel.volume + channel.volume_slide;
101 | | }
102 | | _ => {}
103 | | }
| |_________________________^
|
= 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
|
98 ~ if let PatternEffect::Volume(Volume::Slide(_)) = effect {
99 + channel.volume = channel.volume + channel.volume_slide;
100 + }
|
|
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/
|