1
0
Fork 0

Fix clippy lints

This commit is contained in:
Robbert van der Helm 2022-11-04 21:12:06 +01:00
parent 8f91ecf247
commit e8002730a0
7 changed files with 12 additions and 12 deletions

View file

@ -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 {

View file

@ -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<Option<BundlerConfig>> {
}
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()))?;

View file

@ -27,7 +27,7 @@ pub fn reflink_or_combine<P: AsRef<Path>>(
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(),

View file

@ -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);

View file

@ -139,7 +139,7 @@ pub fn s2v_f32_hz_then_khz() -> Arc<dyn Fn(&str) -> Option<f32> + 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();

View file

@ -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;
}

View file

@ -408,7 +408,7 @@ impl<P: ClapPlugin> Wrapper<P> {
// 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<PluginDescriptor<P>> = 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<P: ClapPlugin> Wrapper<P> {
// 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,
}