From e8002730a023de55480f3ef0559824cfe1ab44b9 Mon Sep 17 00:00:00 2001 From: Robbert van der Helm Date: Fri, 4 Nov 2022 21:12:06 +0100 Subject: [PATCH] Fix clippy lints --- nih_plug_vizia/src/widgets/peak_meter.rs | 2 +- nih_plug_xtask/src/lib.rs | 8 ++++---- nih_plug_xtask/src/util.rs | 2 +- plugins/crossover/src/crossover/iir.rs | 2 +- src/formatters.rs | 2 +- src/params/float.rs | 2 +- src/wrapper/clap/wrapper.rs | 6 +++--- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/nih_plug_vizia/src/widgets/peak_meter.rs b/nih_plug_vizia/src/widgets/peak_meter.rs index ed2b8c29..ce55525e 100644 --- a/nih_plug_vizia/src/widgets/peak_meter.rs +++ b/nih_plug_vizia/src/widgets/peak_meter.rs @@ -197,7 +197,7 @@ where // NOTE: We'll scale this with the nearest integer DPI ratio. That way it will still look // good at 2x scaling, and it won't look blurry at 1.x times scaling. - let dpi_scale = cx.logical_to_physical(1.0).floor().max(1.0) as f32; + let dpi_scale = cx.logical_to_physical(1.0).floor().max(1.0); let bar_tick_coordinates = (bar_ticks_start_x..bar_ticks_end_x) .step_by(((TICK_WIDTH + TICK_GAP) * dpi_scale).round() as usize); for tick_x in bar_tick_coordinates { diff --git a/nih_plug_xtask/src/lib.rs b/nih_plug_xtask/src/lib.rs index 47e70e04..5467150b 100644 --- a/nih_plug_xtask/src/lib.rs +++ b/nih_plug_xtask/src/lib.rs @@ -393,15 +393,15 @@ fn bundle_plugin( // first one. let first_lib_path = lib_paths.first().context("Empty library paths slice")?; - let bundle_clap = symbols::exported(&first_lib_path, "clap_entry") + let bundle_clap = symbols::exported(first_lib_path, "clap_entry") .with_context(|| format!("Could not parse '{}'", first_lib_path.display()))?; // We'll ignore the platofrm-specific entry points for VST2 plugins since there's no reason to // create a new Rust VST2 plugin that doesn't work in modern DAWs // NOTE: NIH-plug does not support VST2, but we'll support bundling VST2 plugins anyways because // this bundler can also be used standalone. - let bundle_vst2 = symbols::exported(&first_lib_path, "VSTPluginMain") + let bundle_vst2 = symbols::exported(first_lib_path, "VSTPluginMain") .with_context(|| format!("Could not parse '{}'", first_lib_path.display()))?; - let bundle_vst3 = symbols::exported(&first_lib_path, "GetPluginFactory") + let bundle_vst3 = symbols::exported(first_lib_path, "GetPluginFactory") .with_context(|| format!("Could not parse '{}'", first_lib_path.display()))?; let bundled_plugin = bundle_clap || bundle_vst2 || bundle_vst3; @@ -514,7 +514,7 @@ fn load_bundler_config() -> Result> { } let result = toml::from_str( - &fs::read_to_string(&bundler_config_path) + &fs::read_to_string(bundler_config_path) .with_context(|| format!("Could not read '{}'", bundler_config_path.display()))?, ) .with_context(|| format!("Could not parse '{}'", bundler_config_path.display()))?; diff --git a/nih_plug_xtask/src/util.rs b/nih_plug_xtask/src/util.rs index 88f3648e..a497a9f0 100644 --- a/nih_plug_xtask/src/util.rs +++ b/nih_plug_xtask/src/util.rs @@ -27,7 +27,7 @@ pub fn reflink_or_combine>( match (from, compilation_target) { ([], _) => anyhow::bail!("The 'from' slice is empty"), ([path], _) => { - reflink(&path, to.as_ref()).with_context(|| { + reflink(path, to.as_ref()).with_context(|| { format!( "Could not copy {} to {}", path.display(), diff --git a/plugins/crossover/src/crossover/iir.rs b/plugins/crossover/src/crossover/iir.rs index 60204600..22841f5e 100644 --- a/plugins/crossover/src/crossover/iir.rs +++ b/plugins/crossover/src/crossover/iir.rs @@ -109,7 +109,7 @@ impl IirCrossover { .crossovers .iter_mut() .zip(band_outputs.iter_mut()) - .take(num_bands as usize - 1) + .take(num_bands - 1) .enumerate() { let (lp_samples, hp_samples) = crossover.process_lr24(samples); diff --git a/src/formatters.rs b/src/formatters.rs index 9c021cef..41dec903 100644 --- a/src/formatters.rs +++ b/src/formatters.rs @@ -139,7 +139,7 @@ pub fn s2v_f32_hz_then_khz() -> Arc Option + Send + Sync> { Arc::new(move |string| { // If the user inputs a note representation, then we'll use that if let Some(midi_note_number) = note_formatter(string) { - return Some(util::midi_note_to_freq(midi_note_number.clamp(0, 127) as u8) as f32); + return Some(util::midi_note_to_freq(midi_note_number.clamp(0, 127) as u8)); } let string = string.trim(); diff --git a/src/params/float.rs b/src/params/float.rs index 48756f55..80cd8b16 100644 --- a/src/params/float.rs +++ b/src/params/float.rs @@ -396,7 +396,7 @@ fn decimals_from_step_size(step_size: f32) -> usize { let mut num_digits = 0; for decimals in 0..f32::DIGITS as i32 { - if step_size * 10.0f32.powi(decimals) as f32 >= 1.0 { + if step_size * 10.0f32.powi(decimals) >= 1.0 { num_digits = decimals; break; } diff --git a/src/wrapper/clap/wrapper.rs b/src/wrapper/clap/wrapper.rs index db834845..a6d1b1a2 100644 --- a/src/wrapper/clap/wrapper.rs +++ b/src/wrapper/clap/wrapper.rs @@ -408,7 +408,7 @@ impl Wrapper

{ // on `Self::updated_state_sender` let (updated_state_sender, updated_state_receiver) = channel::bounded(0); - let plugin_descriptor = Box::new(PluginDescriptor::default()); + let plugin_descriptor: Box> = Box::default(); // We're not allowed to query any extensions until the init function has been called, so we // need a bunch of AtomicRefCells instead @@ -1966,8 +1966,8 @@ impl Wrapper

{ // process all audio until the end of the buffer. match split_result { Some((next_param_change_sample_idx, next_param_change_event_idx)) => { - block_end = next_param_change_sample_idx as usize; - event_start_idx = next_param_change_event_idx as usize; + block_end = next_param_change_sample_idx; + event_start_idx = next_param_change_event_idx; } None => block_end = process.frames_count as usize, }