Skip to content

Commit

Permalink
Fix some clippy::missing_panics_doc instances
Browse files Browse the repository at this point in the history
  • Loading branch information
crumblingstatue committed Oct 24, 2024
1 parent fee6565 commit 1e6eb56
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/audio/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ unsafe extern "C" fn on_stop_callback<R: SoundRecorder>(user_data: *mut c_void)

impl<'a, R: SoundRecorder> SoundRecorderDriver<'a, R> {
/// Creates a new `SoundRecorderDriver` with the specified [`SoundRecorder`].
///
/// # Panics
///
/// Panics if a `SoundRecorderDriver` can't be created for whatever reason
pub fn new(sound_recorder: &'a mut R) -> Self {
Self {
handle: unsafe {
Expand Down Expand Up @@ -244,6 +248,10 @@ pub struct SoundBufferRecorder {

impl SoundBufferRecorder {
/// Create a new sound buffer recorder
///
/// # Panics
///
/// Panics if a `SoundBufferRecorder` can't be created for whatever reason
#[must_use]
pub fn new() -> SoundBufferRecorder {
let buffer = unsafe { ffi::sfSoundBufferRecorder_new() };
Expand Down Expand Up @@ -296,7 +304,7 @@ impl SoundBufferRecorder {
#[must_use]
pub fn buffer(&self) -> &SoundBuffer {
let buff = unsafe { ffi::sfSoundBufferRecorder_getBuffer(self.handle.as_ptr()) };
assert!(!buff.is_null(), "sfSoundBufferRecorder_getBuffer failed");
// Safety: getBuffer returns a reference on C++ side, it can never be null or dangling.
unsafe { &*(buff) }
}
/// Get the name of the current audio capture device.
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
clippy::unwrap_used,
clippy::unreadable_literal,
clippy::ptr_as_ptr,
clippy::cast_lossless
clippy::cast_lossless,
clippy::missing_panics_doc
)]

extern crate link_cplusplus;
Expand Down

0 comments on commit 1e6eb56

Please sign in to comment.