1
0
Fork 0

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:
Robbert van der Helm 2022-07-19 20:20:19 +02:00
parent f007945335
commit 9844d9c490
3 changed files with 10 additions and 10 deletions

View file

@ -293,7 +293,7 @@ pub enum NoteEvent {
impl NoteEvent {
/// Returns the sample within the current buffer this event belongs to.
pub fn timing(&self) -> u32 {
match &self {
match self {
NoteEvent::NoteOn { timing, .. } => *timing,
NoteEvent::NoteOff { timing, .. } => *timing,
NoteEvent::Choke { timing, .. } => *timing,
@ -315,7 +315,7 @@ impl NoteEvent {
/// Returns the event's voice ID, if it has any.
pub fn voice_id(&self) -> Option<i32> {
match &self {
match self {
NoteEvent::NoteOn { voice_id, .. } => *voice_id,
NoteEvent::NoteOff { voice_id, .. } => *voice_id,
NoteEvent::Choke { voice_id, .. } => *voice_id,

View file

@ -146,7 +146,7 @@ macro_rules! param_ptr_forward(
/// Calling this function is only safe as long as the object this [`ParamPtr`] was created
/// for is still alive.
$vis unsafe fn $method(&self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
ParamPtr::IntParam(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
/// for is still alive.
$vis unsafe fn $method(&mut self $(, $arg_name: $arg_ty)*) $(-> $ret)? {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).$method($($arg_name),*),
ParamPtr::IntParam(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
/// still alive.
pub unsafe fn plain_value(&self) -> f32 {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).plain_value(),
ParamPtr::IntParam(p) => (**p).plain_value() as f32,
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
/// still alive.
pub unsafe fn unmodulated_plain_value(&self) -> f32 {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).unmodulated_plain_value(),
ParamPtr::IntParam(p) => (**p).unmodulated_plain_value() as f32,
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
/// still alive.
pub unsafe fn default_plain_value(&self) -> f32 {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).default_plain_value(),
ParamPtr::IntParam(p) => (**p).default_plain_value() as f32,
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
/// still alive.
pub unsafe fn preview_normalized(&self, plain: f32) -> f32 {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).preview_normalized(plain),
ParamPtr::IntParam(p) => (**p).preview_normalized(plain as i32),
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
/// still alive.
pub unsafe fn preview_plain(&self, normalized: f32) -> f32 {
match &self {
match self {
ParamPtr::FloatParam(p) => (**p).preview_plain(normalized),
ParamPtr::IntParam(p) => (**p).preview_plain(normalized) as f32,
ParamPtr::BoolParam(_) => normalized,

View file

@ -47,7 +47,7 @@ pub enum ClapFeature {
impl ClapFeature {
pub fn as_str(&self) -> &'static str {
match &self {
match self {
ClapFeature::Instrument => "instrument",
ClapFeature::AudioEffect => "audio-effect",
ClapFeature::NoteEffect => "note-effect",