diff --git a/nih_plug_vizia/src/widgets/param_base.rs b/nih_plug_vizia/src/widgets/param_base.rs index 7eef61d0..caab3465 100644 --- a/nih_plug_vizia/src/widgets/param_base.rs +++ b/nih_plug_vizia/src/widgets/param_base.rs @@ -42,14 +42,19 @@ where FMap: Fn(&Params) -> &P + Copy + 'static, { fn clone(&self) -> Self { - Self { - param: self.param, - params: self.params.clone(), - params_to_param: self.params_to_param, - } + *self } } +impl Copy for ParamWidgetData +where + L: Lens + Copy, + Params: 'static, + P: Param + 'static, + FMap: Fn(&Params) -> &P + Copy + 'static, +{ +} + impl ParamWidgetData where L: Lens + Clone, @@ -72,7 +77,7 @@ where { let params_to_param = self.params_to_param; - self.params.clone().map(move |params| { + self.params.map(move |params| { let param = params_to_param(params); f(param) }) @@ -136,7 +141,6 @@ impl ParamWidgetBase { // outlive the editor let param: &P = unsafe { &*params - .clone() .map(move |params| params_to_param(params) as *const P) .get(cx) };