Fix new Clippy lints
This commit is contained in:
parent
935bf6f7f3
commit
dfeb8164ca
|
@ -24,7 +24,7 @@ pub fn exported<P: AsRef<Path>>(binary: P, symbol: &str) -> Result<bool> {
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX: Why are all exported symbols on macOS prefixed with an underscore?
|
// XXX: Why are all exported symbols on macOS prefixed with an underscore?
|
||||||
let symbol = format!("_{}", symbol);
|
let symbol = format!("_{symbol}");
|
||||||
|
|
||||||
Ok(obj.exports()?.into_iter().any(|sym| sym.name == symbol))
|
Ok(obj.exports()?.into_iter().any(|sym| sym.name == symbol))
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,6 @@ impl Default for Crisp {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CrispParams {
|
impl Default for CrispParams {
|
||||||
#[allow(clippy::derivable_impls)]
|
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
let f32_hz_then_khz = formatters::v2s_f32_hz_then_khz(0);
|
let f32_hz_then_khz = formatters::v2s_f32_hz_then_khz(0);
|
||||||
let from_f32_hz_then_khz = formatters::s2v_f32_hz_then_khz();
|
let from_f32_hz_then_khz = formatters::s2v_f32_hz_then_khz();
|
||||||
|
@ -176,7 +175,7 @@ impl Default for CrispParams {
|
||||||
if value >= MAX_FILTER_FREQUENCY {
|
if value >= MAX_FILTER_FREQUENCY {
|
||||||
String::from("Disabled")
|
String::from("Disabled")
|
||||||
} else {
|
} else {
|
||||||
format!("{:.0} Hz", value)
|
format!("{value:.0} Hz")
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
.with_string_to_value(Arc::new(|string| {
|
.with_string_to_value(Arc::new(|string| {
|
||||||
|
|
|
@ -127,8 +127,8 @@ impl CrossoverParams {
|
||||||
.with_string_to_value(crossover_string_to_value.clone()),
|
.with_string_to_value(crossover_string_to_value.clone()),
|
||||||
crossover_4_freq: FloatParam::new("Crossover 4", 10000.0, crossover_range)
|
crossover_4_freq: FloatParam::new("Crossover 4", 10000.0, crossover_range)
|
||||||
.with_smoother(crossover_smoothing_style)
|
.with_smoother(crossover_smoothing_style)
|
||||||
.with_value_to_string(crossover_value_to_string.clone())
|
.with_value_to_string(crossover_value_to_string)
|
||||||
.with_string_to_value(crossover_string_to_value.clone()),
|
.with_string_to_value(crossover_string_to_value),
|
||||||
|
|
||||||
crossover_type: EnumParam::new("Type", CrossoverType::LinkwitzRiley24).with_callback(
|
crossover_type: EnumParam::new("Type", CrossoverType::LinkwitzRiley24).with_callback(
|
||||||
Arc::new(move |_| should_update_filters.store(true, Ordering::Relaxed)),
|
Arc::new(move |_| should_update_filters.store(true, Ordering::Relaxed)),
|
||||||
|
|
|
@ -133,7 +133,7 @@ impl Plugin for Gain {
|
||||||
let peak_meter =
|
let peak_meter =
|
||||||
util::gain_to_db(peak_meter.load(std::sync::atomic::Ordering::Relaxed));
|
util::gain_to_db(peak_meter.load(std::sync::atomic::Ordering::Relaxed));
|
||||||
let peak_meter_text = if peak_meter > util::MINUS_INFINITY_DB {
|
let peak_meter_text = if peak_meter > util::MINUS_INFINITY_DB {
|
||||||
format!("{:.1} dBFS", peak_meter)
|
format!("{peak_meter:.1} dBFS")
|
||||||
} else {
|
} else {
|
||||||
String::from("-inf dBFS")
|
String::from("-inf dBFS")
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ use crate::util;
|
||||||
|
|
||||||
/// Round an `f32` value to always have a specific number of decimal digits.
|
/// Round an `f32` value to always have a specific number of decimal digits.
|
||||||
pub fn v2s_f32_rounded(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
pub fn v2s_f32_rounded(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
||||||
Arc::new(move |value| format!("{:.digits$}", value))
|
Arc::new(move |value| format!("{value:.digits$}"))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Format a `[0, 1]` number as a percentage. Does not include the percent sign, you should specify
|
/// Format a `[0, 1]` number as a percentage. Does not include the percent sign, you should specify
|
||||||
|
@ -41,7 +41,7 @@ pub fn s2v_f32_percentage() -> Arc<dyn Fn(&str) -> Option<f32> + Send + Sync> {
|
||||||
pub fn v2s_compression_ratio(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
pub fn v2s_compression_ratio(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
||||||
Arc::new(move |value| {
|
Arc::new(move |value| {
|
||||||
if value >= 1.0 {
|
if value >= 1.0 {
|
||||||
format!("{:.digits$}:1", value)
|
format!("{value:.digits$}:1")
|
||||||
} else {
|
} else {
|
||||||
format!("1:{:.digits$}", value.recip())
|
format!("1:{:.digits$}", value.recip())
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ pub fn v2s_f32_gain_to_db(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + S
|
||||||
let value_db = util::gain_to_db(value);
|
let value_db = util::gain_to_db(value);
|
||||||
let value_db = if value_db.abs() < 1e-6 { 0.0 } else { value_db };
|
let value_db = if value_db.abs() < 1e-6 { 0.0 } else { value_db };
|
||||||
|
|
||||||
format!("{:.digits$}", value_db)
|
format!("{value_db:.digits$}")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ pub fn s2v_f32_panning() -> Arc<dyn Fn(&str) -> Option<f32> + Send + Sync> {
|
||||||
pub fn v2s_f32_hz_then_khz(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
pub fn v2s_f32_hz_then_khz(digits: usize) -> Arc<dyn Fn(f32) -> String + Send + Sync> {
|
||||||
Arc::new(move |value| {
|
Arc::new(move |value| {
|
||||||
if value < 1000.0 {
|
if value < 1000.0 {
|
||||||
format!("{:.digits$} Hz", value)
|
format!("{value:.digits$} Hz")
|
||||||
} else {
|
} else {
|
||||||
format!("{:.digits$} kHz", value / 1000.0, digits = digits.max(1))
|
format!("{:.digits$} kHz", value / 1000.0, digits = digits.max(1))
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ pub fn v2s_f32_hz_then_khz_with_note_name(
|
||||||
};
|
};
|
||||||
|
|
||||||
if value < 1000.0 {
|
if value < 1000.0 {
|
||||||
format!("{:.digits$} Hz, {}", value, note_str)
|
format!("{value:.digits$} Hz, {note_str}")
|
||||||
} else {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"{:.digits$} kHz, {}",
|
"{:.digits$} kHz, {}",
|
||||||
|
|
|
@ -163,10 +163,10 @@ impl Param for FloatParam {
|
||||||
}
|
}
|
||||||
(None, Some(step_size), false) => {
|
(None, Some(step_size), false) => {
|
||||||
let num_digits = decimals_from_step_size(*step_size);
|
let num_digits = decimals_from_step_size(*step_size);
|
||||||
format!("{:.num_digits$}", value)
|
format!("{value:.num_digits$}")
|
||||||
}
|
}
|
||||||
(None, None, true) => format!("{}{}", value, self.unit),
|
(None, None, true) => format!("{}{}", value, self.unit),
|
||||||
(None, None, false) => format!("{}", value),
|
(None, None, false) => format!("{value}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ impl Param for IntParam {
|
||||||
(Some(f), true) => format!("{}{}", f(value), self.unit),
|
(Some(f), true) => format!("{}{}", f(value), self.unit),
|
||||||
(Some(f), false) => f(value),
|
(Some(f), false) => f(value),
|
||||||
(None, true) => format!("{}{}", value, self.unit),
|
(None, true) => format!("{}{}", value, self.unit),
|
||||||
(None, false) => format!("{}", value),
|
(None, false) => format!("{value}"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,6 @@ impl ParamUnits {
|
||||||
// don't contain any parameters and thus aren't present in `groups`.
|
// don't contain any parameters and thus aren't present in `groups`.
|
||||||
let unique_group_names: HashSet<String> = groups
|
let unique_group_names: HashSet<String> = groups
|
||||||
.clone()
|
.clone()
|
||||||
.into_iter()
|
|
||||||
.filter_map(|(_, group_name)| {
|
.filter_map(|(_, group_name)| {
|
||||||
// The root should not be included here since that's a special case in VST3
|
// The root should not be included here since that's a special case in VST3
|
||||||
if !group_name.is_empty() {
|
if !group_name.is_empty() {
|
||||||
|
|
Loading…
Reference in a new issue