Skip to content

Commit

Permalink
Clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Enet4 committed Mar 17, 2022
1 parent f2601bf commit cc94847
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/music.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ impl Music {
// no data is never written via the pointer.
unsafe {
let music = dos_like_sys::createmus(data.as_ptr() as *mut _, data.len() as c_int);
if let Some(music) = NonNull::new(music) {
Some(Music(music))
} else {
None
}
NonNull::new(music).map(Music)
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/sound.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,7 @@ pub fn try_create_sound(channels: u32, sample_rate: u32, samples: &[u16]) -> Opt
samples.len() as c_int,
samples.as_ptr() as *mut c_short,
);
if let Some(sound) = NonNull::new(sound) {
Some(Sound(sound))
} else {
None
}
NonNull::new(sound).map(Sound)
}
}

Expand Down

0 comments on commit cc94847

Please # to comment.