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

View File

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