clippy
1 error, 38 warnings
Details
Results
Message level | Amount |
---|---|
Internal compiler error | 0 |
Error | 1 |
Warning | 38 |
Note | 0 |
Help | 0 |
Versions
- rustc 1.83.0-nightly (2bd1e894e 2024-09-26)
- cargo 1.83.0-nightly (eaee77dc1 2024-09-19)
- clippy 0.1.83 (2bd1e89 2024-09-26)
Annotations
Check warning on line 249 in engine/src/asset/sound/sample.rs
github-actions / clippy
casting `f32` to `usize` may lose the sign of the value
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
Check warning on line 243 in engine/src/asset/sound/sample.rs
github-actions / clippy
casting `f32` to `usize` may lose the sign of the value
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
Check warning on line 236 in engine/src/asset/sound/sample.rs
github-actions / clippy
casting `f32` to `usize` may lose the sign of the value
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
Check warning on line 162 in engine/src/asset/sound/sample.rs
github-actions / clippy
casting `f64` to `usize` may lose the sign of the value
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
Check warning on line 292 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
using `clone` on type `PatternEffect` which implements the `Copy` trait
warning: using `clone` on type `PatternEffect` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:292:46
|
292 | 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
Check warning on line 287 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
using `clone` on type `PatternEventVolume` which implements the `Copy` trait
warning: using `clone` on type `PatternEventVolume` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:287:39
|
287 | 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
Check warning on line 283 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
using `clone` on type `PatternEventNote` which implements the `Copy` trait
warning: using `clone` on type `PatternEventNote` which implements the `Copy` trait
--> engine/src/asset/sound/dat/mixer_new.rs:283:37
|
283 | 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
Check warning on line 162 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
casting `i32` to `usize` may lose the sign of the value
warning: casting `i32` to `usize` may lose the sign of the value
--> engine/src/asset/sound/dat/mixer_new.rs:162:54
|
162 | 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
Check warning on line 162 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
assigning the result of `Clone::clone()` may be inefficient
warning: assigning the result of `Clone::clone()` may be inefficient
--> engine/src/asset/sound/dat/mixer_new.rs:162:21
|
162 | 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)]`
Check warning on line 126 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
consider adding a `;` to the last statement for consistent formatting
warning: consider adding a `;` to the last statement for consistent formatting
--> engine/src/asset/sound/dat/mixer_new.rs:126:17
|
126 | 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
Check warning on line 17 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
methods called `into_*` usually take `self` by value
warning: methods called `into_*` usually take `self` by value
--> engine/src/asset/sound/dat/mixer_new.rs:17:19
|
17 | 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
Check warning on line 15 in engine/src/asset/sound/dat/mixer_new.rs
github-actions / clippy
methods called `into_*` usually take `self` by value
warning: methods called `into_*` usually take `self` by value
--> engine/src/asset/sound/dat/mixer_new.rs:15:28
|
15 | 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
Check warning on line 74 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
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 + }); }
|
Check warning on line 60 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
variables can be used directly in the `format!` string
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:?}"))
|
Check warning on line 62 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
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 + }); }
|
Check warning on line 55 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
variables can be used directly in the `format!` string
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:?}"))
|
Check warning on line 57 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
called `map(f)` on an `Option` value where `f` is a closure that returns the unit type `()`
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 + }); }
|
Check warning on line 38 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
redundant closure
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)]`
Check warning on line 93 in engine/src/asset/sound/dat/t_song.rs
github-actions / clippy
manual `Debug` impl does not include all fields
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)]`
Check warning on line 279 in engine/src/asset/sound/dat/t_instrument.rs
github-actions / clippy
casting `f64` to `usize` may lose the sign of the value
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
Check warning on line 276 in engine/src/asset/sound/dat/t_instrument.rs
github-actions / clippy
casting `f64` to `usize` may lose the sign of the value
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
Check warning on line 244 in engine/src/asset/sound/dat/t_instrument.rs
github-actions / clippy
this `.into_iter()` call is equivalent to `.iter()` and will not consume the `slice`
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
Check warning on line 34 in engine/src/asset/sound/dat/t_instrument.rs
github-actions / clippy
use of `expect` followed by a function call
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
Check warning on line 131 in engine/src/asset/sound/dat/pattern_event.rs
github-actions / clippy
consider using `Option<T>` instead of `Option<Option<T>>` or a custom enum if you need to distinguish all 3 cases
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)]`
Check warning on line 68 in engine/src/asset/sound/dat/pattern_event.rs
github-actions / clippy
use of `expect` followed by a function call
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