Fix clippy::match_like_matches_macro

This commit is contained in:
Zhiming Wang 2020-10-11 10:07:33 +08:00
parent 39d5979f73
commit b0722df007
No known key found for this signature in database
GPG Key ID: 5B58F95EC95965D8
2 changed files with 7 additions and 35 deletions

View File

@ -19,11 +19,7 @@ unsafe impl Send for Context {}
impl Context { impl Context {
pub fn is_input(&self) -> bool { pub fn is_input(&self) -> bool {
if let Context::Input(..) = *self { matches!(*self, Context::Input(..))
true
} else {
false
}
} }
pub fn input(self) -> Input { pub fn input(self) -> Input {
@ -35,11 +31,7 @@ impl Context {
} }
pub fn is_output(&self) -> bool { pub fn is_output(&self) -> bool {
if let Context::Output(..) = *self { matches!(*self, Context::Output(..))
true
} else {
false
}
} }
pub fn output(self) -> Output { pub fn output(self) -> Output {

View File

@ -249,11 +249,7 @@ pub unsafe trait Sample {
unsafe impl Sample for u8 { unsafe impl Sample for u8 {
#[inline(always)] #[inline(always)]
fn is_valid(format: format::Sample, _channels: u16) -> bool { fn is_valid(format: format::Sample, _channels: u16) -> bool {
if let format::Sample::U8(..) = format { matches!(format, format::Sample::U8(..))
true
} else {
false
}
} }
} }
@ -302,11 +298,7 @@ unsafe impl Sample for (u8, u8, u8, u8, u8, u8, u8) {
unsafe impl Sample for i16 { unsafe impl Sample for i16 {
#[inline(always)] #[inline(always)]
fn is_valid(format: format::Sample, _channels: u16) -> bool { fn is_valid(format: format::Sample, _channels: u16) -> bool {
if let format::Sample::I16(..) = format { matches!(format, format::Sample::I16(..))
true
} else {
false
}
} }
} }
@ -355,11 +347,7 @@ unsafe impl Sample for (i16, i16, i16, i16, i16, i16, i16) {
unsafe impl Sample for i32 { unsafe impl Sample for i32 {
#[inline(always)] #[inline(always)]
fn is_valid(format: format::Sample, _channels: u16) -> bool { fn is_valid(format: format::Sample, _channels: u16) -> bool {
if let format::Sample::I32(..) = format { matches!(format, format::Sample::I32(..))
true
} else {
false
}
} }
} }
@ -408,11 +396,7 @@ unsafe impl Sample for (i32, i32, i32, i32, i32, i32, i32) {
unsafe impl Sample for f32 { unsafe impl Sample for f32 {
#[inline(always)] #[inline(always)]
fn is_valid(format: format::Sample, _channels: u16) -> bool { fn is_valid(format: format::Sample, _channels: u16) -> bool {
if let format::Sample::F32(..) = format { matches!(format, format::Sample::F32(..))
true
} else {
false
}
} }
} }
@ -461,11 +445,7 @@ unsafe impl Sample for (f32, f32, f32, f32, f32, f32, f32) {
unsafe impl Sample for f64 { unsafe impl Sample for f64 {
#[inline(always)] #[inline(always)]
fn is_valid(format: format::Sample, _channels: u16) -> bool { fn is_valid(format: format::Sample, _channels: u16) -> bool {
if let format::Sample::F64(..) = format { matches!(format, format::Sample::F64(..))
true
} else {
false
}
} }
} }