Skip to content

Commit

Permalink
Use match instead of if-else to unpack ptr from Option
Browse files Browse the repository at this point in the history
This silences a warning on nightly rustc
  • Loading branch information
Pehrsons committed Oct 24, 2023
1 parent 1cc2d92 commit 25175bf
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/backend/resampler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@ impl Resampler {
reclock: ffi::cubeb_resampler_reclock,
) -> Self {
let raw_resampler = unsafe {
let in_params = if input_params.is_some() {
input_params.as_mut().unwrap() as *mut ffi::cubeb_stream_params
} else {
ptr::null_mut()
let in_params = match &mut input_params {
Some(p) => p,
None => ptr::null_mut(),
};
let out_params = if output_params.is_some() {
output_params.as_mut().unwrap() as *mut ffi::cubeb_stream_params
} else {
ptr::null_mut()
let out_params = match &mut output_params {
Some(p) => p,
None => ptr::null_mut(),
};
ffi::cubeb_resampler_create(
stream,
Expand Down

0 comments on commit 25175bf

Please sign in to comment.