Skip to content

Commit 3d3eed9

Browse files
committed
Address clippy lints
1 parent f6c0d28 commit 3d3eed9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/os/unix/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ impl<T> Symbol<T> {
400400
/// Convert the loaded `Symbol` into a raw pointer.
401401
/// For unix this does the same as into_raw.
402402
pub fn as_raw_ptr(self) -> *mut raw::c_void {
403-
return self.pointer
403+
self.pointer
404404
}
405405
}
406406

src/safe.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
use super::Error;
21
#[cfg(libloading_docs)]
32
use super::os::unix as imp; // the implementation used here doesn't matter particularly much...
43
#[cfg(all(not(libloading_docs), unix))]
54
use super::os::unix as imp;
65
#[cfg(all(not(libloading_docs), windows))]
76
use super::os::windows as imp;
7+
use super::Error;
88
use std::ffi::OsStr;
99
use std::fmt;
1010
use std::marker;
@@ -260,7 +260,14 @@ impl<'lib, T> Symbol<'lib, T> {
260260
/// ensure the resulting `Symbol` is not used past the lifetime of the `Library` this symbol
261261
/// was loaded from.
262262
pub unsafe fn try_as_raw_ptr(self) -> Option<*mut raw::c_void> {
263-
return Some(unsafe{self.into_raw()}.as_raw_ptr());
263+
Some(
264+
#[allow(unused_unsafe)] // 1.56.0 compat
265+
unsafe {
266+
// SAFE: the calling function has the same soundness invariants as this callee.
267+
self.into_raw()
268+
}
269+
.as_raw_ptr(),
270+
)
264271
}
265272
}
266273

@@ -309,4 +316,5 @@ impl<'lib, T> fmt::Debug for Symbol<'lib, T> {
309316
}
310317

311318
unsafe impl<'lib, T: Send> Send for Symbol<'lib, T> {}
312-
unsafe impl<'lib, T: Sync> Sync for Symbol<'lib, T> {}
319+
unsafe impl<'lib, T: Sync> Sync for Symbol<'lib, T> {}
320+

0 commit comments

Comments
 (0)