Browse Source

Remove redundant pattern

`s/@\ _\ //g`
master
Andreas Linz 5 years ago
parent
commit
7748e9e4de
2 changed files with 17 additions and 17 deletions
  1. +8
    -8
      src/base.rs
  2. +9
    -9
      src/stream.rs

+ 8
- 8
src/base.rs View File

@ -44,7 +44,7 @@ impl SoundIo {
pub fn connect(&self) -> SioResult<()> {
match unsafe { ffi::soundio_connect(self.context) } {
ffi::enums::SioError::None => Ok(()),
err @ _ => Err(err),
err => Err(err),
}
}
@ -61,7 +61,7 @@ impl SoundIo {
pub fn connect_backend(&self, backend: ffi::enums::SioBackend) -> SioResult<()> {
match unsafe { ffi::soundio_connect_backend(self.context, backend) } {
ffi::enums::SioError::None => Ok(()),
err @ _ => Err(err),
err => Err(err),
}
}
@ -76,7 +76,7 @@ impl SoundIo {
pub fn backend(&self, idx: u32) -> Option<ffi::enums::SioBackend> {
match unsafe { ffi::soundio_get_backend(self.context, idx as c_int) } {
ffi::enums::SioBackend::None => None,
backend @ _ => Some(backend),
backend => Some(backend),
}
}
@ -85,7 +85,7 @@ impl SoundIo {
pub fn current_backend(&self) -> Option<ffi::enums::SioBackend> {
match unsafe { (*self.context).current_backend } {
ffi::enums::SioBackend::None => None,
backend @ _ => Some(backend),
backend => Some(backend),
}
}
@ -205,7 +205,7 @@ impl SoundIo {
pub fn default_input_device_index(&self) -> Option<u32> {
match unsafe { ffi::soundio_default_input_device_index(self.context) } {
-1 => None,
idx @ _ => Some(idx as u32),
idx => Some(idx as u32),
}
}
@ -215,7 +215,7 @@ impl SoundIo {
pub fn default_output_device_index(&self) -> Option<u32> {
match unsafe { ffi::soundio_default_output_device_index(self.context) } {
-1 => None,
idx @ _ => Some(idx as u32),
idx => Some(idx as u32),
}
}
@ -297,7 +297,7 @@ impl ChannelLayout {
pub fn find_channel(&self, channel: ffi::enums::SioChannelId) -> Option<u32> {
match unsafe { ffi::soundio_channel_layout_find_channel(self.layout, channel) } {
-1 => None,
idx @ _ => Some(idx as u32),
idx => Some(idx as u32),
}
}
@ -446,7 +446,7 @@ impl Device {
pub fn probe_error(&self) -> Option<ffi::enums::SioError> {
match unsafe { (*self.device).probe_error } {
ffi::enums::SioError::None => None,
error @ _ => Some(error),
error => Some(error),
}
}
}

+ 9
- 9
src/stream.rs View File

@ -131,7 +131,7 @@ impl<'a> OutStream<'a> {
pub fn open(&self) -> SioResult<()> {
match unsafe { ffi::soundio_outstream_open(self.stream) } {
ffi::enums::SioError::None => Ok(()),
err @ _ => Err(err),
err => Err(err),
}
}
@ -148,7 +148,7 @@ impl<'a> OutStream<'a> {
pub fn start(&self) -> SioResult<()> {
match unsafe { ffi::soundio_outstream_start(self.stream) } {
ffi::enums::SioError::None => Ok(()),
err @ _ => Err(err),
err => Err(err),
}
}
@ -240,14 +240,14 @@ impl<'a> OutStream<'a> {
&mut actual_frame_count as *mut c_int)
} {
ffi::enums::SioError::None => Ok(actual_frame_count as u32),
err @ _ => Err(err),
err => Err(err),
}
}
fn end_write(&self) -> Option<ffi::enums::SioError> {
match unsafe { ffi::soundio_outstream_end_write(self.stream) } {
ffi::enums::SioError::None => None,
err @ _ => Some(err),
err => Some(err),
}
}
@ -267,7 +267,7 @@ impl<'a> OutStream<'a> {
pub fn clear_buffer(&self) -> Option<ffi::enums::SioError> {
match unsafe { ffi::soundio_outstream_clear_buffer(self.stream) } {
ffi::enums::SioError::None => None,
err @ _ => Some(err),
err => Some(err),
}
}
@ -319,7 +319,7 @@ impl<'a> OutStream<'a> {
match unsafe { ffi::soundio_outstream_pause(self.stream, pause_c_bool) } {
ffi::enums::SioError::None => None,
err @ _ => Some(err),
err => Some(err),
}
}
@ -339,7 +339,7 @@ impl<'a> OutStream<'a> {
ffi::soundio_outstream_get_latency(self.stream, &mut latency as *mut c_double)
} {
ffi::enums::SioError::None => Ok(latency),
err @ _ => Err(err),
err => Err(err),
}
}
@ -349,7 +349,7 @@ impl<'a> OutStream<'a> {
pub fn format(&self) -> SioResult<ffi::enums::SioFormat> {
match unsafe { (*self.stream).format } {
ffi::enums::SioFormat::Invalid => Err(ffi::enums::SioError::Invalid),
fmt @ _ => Ok(fmt),
fmt => Ok(fmt),
}
}
@ -424,7 +424,7 @@ impl<'a> OutStream<'a> {
pub fn layout_error(&self) -> SioResult<()> {
match unsafe { (*self.stream).layout_error } {
0 => Ok(()),
e @ _ => {
e => {
println!("layout error: {}", e);
Ok(())
}

Loading…
Cancel
Save