Change match &self to match self
This is equivalent when taking a reference to self, and you can't do the same thing with &mut self.
This commit is contained in:
parent
f007945335
commit
9844d9c490
|
@ -293,7 +293,7 @@ pub enum NoteEvent {
|
||||||
impl NoteEvent {
|
impl NoteEvent {
|
||||||
/// Returns the sample within the current buffer this event belongs to.
|
/// Returns the sample within the current buffer this event belongs to.
|
||||||
pub fn timing(&self) -> u32 {
|
pub fn timing(&self) -> u32 {
|
||||||
match &self {
|
match self {
|
||||||
NoteEvent::NoteOn { timing, .. } => *timing,
|
NoteEvent::NoteOn { timing, .. } => *timing,
|
||||||
NoteEvent::NoteOff { timing, .. } => *timing,
|
NoteEvent::NoteOff { timing, .. } => *timing,
|
||||||
NoteEvent::Choke { timing, .. } => *timing,
|
NoteEvent::Choke { timing, .. } => *timing,
|
||||||
|
@ -315,7 +315,7 @@ impl NoteEvent {
|
||||||
|
|
||||||
/// Returns the event's voice ID, if it has any.
|
/// Returns the event's voice ID, if it has any.
|
||||||
pub fn voice_id(&self) -> Option<i32> {
|
pub fn voice_id(&self) -> Option<i32> {
|
||||||
match &self {
|
match self {
|
||||||
NoteEvent::NoteOn { voice_id, .. } => *voice_id,
|
NoteEvent::NoteOn { voice_id, .. } => *voice_id,
|
||||||
NoteEvent::NoteOff { voice_id, .. } => *voice_id,
|
NoteEvent::NoteOff { voice_id, .. } => *voice_id,
|
||||||
NoteEvent::Choke { voice_id, .. } => *voice_id,
|
NoteEvent::Choke { voice_id, .. } => *voice_id,
|
||||||
|
|
|
@ -146,7 +146,7 @@ macro_rules! param_ptr_forward(
|
||||||
/// Calling this function is only safe as long as the object this [`ParamPtr`] was created
|
/// Calling this function is only safe as long as the object this [`ParamPtr`] was created
|
||||||
/// for is still alive.
|
/// for is still alive.
|
||||||
$vis unsafe fn $method(&self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
|
$vis unsafe fn $method(&self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
|
||||||
ParamPtr::IntParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::IntParam(p) => (**p).$method($($arg_name),*),
|
||||||
ParamPtr::BoolParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::BoolParam(p) => (**p).$method($($arg_name),*),
|
||||||
|
@ -164,7 +164,7 @@ macro_rules! param_ptr_forward(
|
||||||
/// Calling this function is only safe as long as the object this [`ParamPtr`] was created
|
/// Calling this function is only safe as long as the object this [`ParamPtr`] was created
|
||||||
/// for is still alive.
|
/// for is still alive.
|
||||||
$vis unsafe fn $method(&mut self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
|
$vis unsafe fn $method(&mut self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
|
||||||
ParamPtr::IntParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::IntParam(p) => (**p).$method($($arg_name),*),
|
||||||
ParamPtr::BoolParam(p) => (**p).$method($($arg_name),*),
|
ParamPtr::BoolParam(p) => (**p).$method($($arg_name),*),
|
||||||
|
@ -205,7 +205,7 @@ impl ParamPtr {
|
||||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
/// still alive.
|
/// still alive.
|
||||||
pub unsafe fn plain_value(&self) -> f32 {
|
pub unsafe fn plain_value(&self) -> f32 {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).plain_value(),
|
ParamPtr::FloatParam(p) => (**p).plain_value(),
|
||||||
ParamPtr::IntParam(p) => (**p).plain_value() as f32,
|
ParamPtr::IntParam(p) => (**p).plain_value() as f32,
|
||||||
ParamPtr::BoolParam(p) => (**p).normalized_value(),
|
ParamPtr::BoolParam(p) => (**p).normalized_value(),
|
||||||
|
@ -227,7 +227,7 @@ impl ParamPtr {
|
||||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
/// still alive.
|
/// still alive.
|
||||||
pub unsafe fn unmodulated_plain_value(&self) -> f32 {
|
pub unsafe fn unmodulated_plain_value(&self) -> f32 {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).unmodulated_plain_value(),
|
ParamPtr::FloatParam(p) => (**p).unmodulated_plain_value(),
|
||||||
ParamPtr::IntParam(p) => (**p).unmodulated_plain_value() as f32,
|
ParamPtr::IntParam(p) => (**p).unmodulated_plain_value() as f32,
|
||||||
ParamPtr::BoolParam(p) => (**p).unmodulated_normalized_value(),
|
ParamPtr::BoolParam(p) => (**p).unmodulated_normalized_value(),
|
||||||
|
@ -242,7 +242,7 @@ impl ParamPtr {
|
||||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
/// still alive.
|
/// still alive.
|
||||||
pub unsafe fn default_plain_value(&self) -> f32 {
|
pub unsafe fn default_plain_value(&self) -> f32 {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).default_plain_value(),
|
ParamPtr::FloatParam(p) => (**p).default_plain_value(),
|
||||||
ParamPtr::IntParam(p) => (**p).default_plain_value() as f32,
|
ParamPtr::IntParam(p) => (**p).default_plain_value() as f32,
|
||||||
ParamPtr::BoolParam(p) => (**p).normalized_value(),
|
ParamPtr::BoolParam(p) => (**p).normalized_value(),
|
||||||
|
@ -258,7 +258,7 @@ impl ParamPtr {
|
||||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
/// still alive.
|
/// still alive.
|
||||||
pub unsafe fn preview_normalized(&self, plain: f32) -> f32 {
|
pub unsafe fn preview_normalized(&self, plain: f32) -> f32 {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).preview_normalized(plain),
|
ParamPtr::FloatParam(p) => (**p).preview_normalized(plain),
|
||||||
ParamPtr::IntParam(p) => (**p).preview_normalized(plain as i32),
|
ParamPtr::IntParam(p) => (**p).preview_normalized(plain as i32),
|
||||||
ParamPtr::BoolParam(_) => plain,
|
ParamPtr::BoolParam(_) => plain,
|
||||||
|
@ -274,7 +274,7 @@ impl ParamPtr {
|
||||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||||
/// still alive.
|
/// still alive.
|
||||||
pub unsafe fn preview_plain(&self, normalized: f32) -> f32 {
|
pub unsafe fn preview_plain(&self, normalized: f32) -> f32 {
|
||||||
match &self {
|
match self {
|
||||||
ParamPtr::FloatParam(p) => (**p).preview_plain(normalized),
|
ParamPtr::FloatParam(p) => (**p).preview_plain(normalized),
|
||||||
ParamPtr::IntParam(p) => (**p).preview_plain(normalized) as f32,
|
ParamPtr::IntParam(p) => (**p).preview_plain(normalized) as f32,
|
||||||
ParamPtr::BoolParam(_) => normalized,
|
ParamPtr::BoolParam(_) => normalized,
|
||||||
|
|
|
@ -47,7 +47,7 @@ pub enum ClapFeature {
|
||||||
|
|
||||||
impl ClapFeature {
|
impl ClapFeature {
|
||||||
pub fn as_str(&self) -> &'static str {
|
pub fn as_str(&self) -> &'static str {
|
||||||
match &self {
|
match self {
|
||||||
ClapFeature::Instrument => "instrument",
|
ClapFeature::Instrument => "instrument",
|
||||||
ClapFeature::AudioEffect => "audio-effect",
|
ClapFeature::AudioEffect => "audio-effect",
|
||||||
ClapFeature::NoteEffect => "note-effect",
|
ClapFeature::NoteEffect => "note-effect",
|
||||||
|
|
Loading…
Reference in a new issue