Feat/better mixer #189
test.yml
on: pull_request
ubuntu / nightly / direct-minimal-versions
39s
Matrix: os-check
Matrix: required
Annotations
4 errors and 19 warnings
ubuntu / nightly / direct-minimal-versions
Process completed with exit code 101.
|
macos-latest / nightly
Process completed with exit code 101.
|
ubuntu / nightly
Process completed with exit code 101.
|
windows-latest / nightly
Process completed with exit code 1.
|
`as` casting between raw pointers without changing its mutability:
engine/src/utils/iterator.rs#L8
warning: `as` casting between raw pointers without changing its mutability
--> engine/src/utils/iterator.rs:8:25
|
8 | let array_ptr = array.as_mut_ptr() as *mut Self::Item;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast`, a safer alternative: `array.as_mut_ptr().cast::<Self::Item>()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#ptr_as_ptr
= note: `#[warn(clippy::ptr_as_ptr)]` implied by `#[warn(clippy::pedantic)]`
|
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#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_envelope_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)]`
|