1
0
Fork 0

Fix new Clippy lints

This commit is contained in:
Robbert van der Helm 2023-01-06 16:07:42 +01:00
parent 935bf6f7f3
commit dfeb8164ca
8 changed files with 13 additions and 15 deletions

View file

@ -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?
let symbol = format!("_{}", symbol);
let symbol = format!("_{symbol}");
Ok(obj.exports()?.into_iter().any(|sym| sym.name == symbol))
}

View file

@ -144,7 +144,6 @@ impl Default for Crisp {
}
impl Default for CrispParams {
#[allow(clippy::derivable_impls)]
fn default() -> Self {
let f32_hz_then_khz = formatters::v2s_f32_hz_then_khz(0);
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 {
String::from("Disabled")
} else {
format!("{:.0} Hz", value)
format!("{value:.0} Hz")
}
}))
.with_string_to_value(Arc::new(|string| {

View file

@ -127,8 +127,8 @@ impl CrossoverParams {
.with_string_to_value(crossover_string_to_value.clone()),
crossover_4_freq: FloatParam::new("Crossover 4", 10000.0, crossover_range)
.with_smoother(crossover_smoothing_style)
.with_value_to_string(crossover_value_to_string.clone())
.with_string_to_value(crossover_string_to_value.clone()),
.with_value_to_string(crossover_value_to_string)
.with_string_to_value(crossover_string_to_value),
crossover_type: EnumParam::new("Type", CrossoverType::LinkwitzRiley24).with_callback(
Arc::new(move |_| should_update_filters.store(true, Ordering::Relaxed)),

View file

@ -133,7 +133,7 @@ impl Plugin for Gain {
let peak_meter =
util::gain_to_db(peak_meter.load(std::sync::atomic::Ordering::Relaxed));
let peak_meter_text = if peak_meter > util::MINUS_INFINITY_DB {
format!("{:.1} dBFS", peak_meter)
format!("{peak_meter:.1} dBFS")
} else {
String::from("-inf dBFS")
};

View file

@ -15,7 +15,7 @@ use crate::util;
/// 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> {
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
@ -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> {
Arc::new(move |value| {
if value >= 1.0 {
format!("{:.digits$}:1", value)
format!("{value:.digits$}:1")
} else {
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 = 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> {
Arc::new(move |value| {
if value < 1000.0 {
format!("{:.digits$} Hz", value)
format!("{value:.digits$} Hz")
} else {
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 {
format!("{:.digits$} Hz, {}", value, note_str)
format!("{value:.digits$} Hz, {note_str}")
} else {
format!(
"{:.digits$} kHz, {}",

View file

@ -163,10 +163,10 @@ impl Param for FloatParam {
}
(None, Some(step_size), false) => {
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, false) => format!("{}", value),
(None, None, false) => format!("{value}"),
}
}

View file

@ -150,7 +150,7 @@ impl Param for IntParam {
(Some(f), true) => format!("{}{}", f(value), self.unit),
(Some(f), false) => f(value),
(None, true) => format!("{}{}", value, self.unit),
(None, false) => format!("{}", value),
(None, false) => format!("{value}"),
}
}

View file

@ -55,7 +55,6 @@ impl ParamUnits {
// don't contain any parameters and thus aren't present in `groups`.
let unique_group_names: HashSet<String> = groups
.clone()
.into_iter()
.filter_map(|(_, group_name)| {
// The root should not be included here since that's a special case in VST3
if !group_name.is_empty() {