aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 00bc931..ca47cea 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -75,7 +75,20 @@
)
))]
#![warn(missing_docs, rust_2018_idioms, single_use_lifetimes, unreachable_pub)]
-#![warn(clippy::default_trait_access, clippy::wildcard_imports)]
+#![warn(
+ clippy::pedantic,
+ // lints for public library
+ clippy::alloc_instead_of_core,
+ clippy::exhaustive_enums,
+ clippy::exhaustive_structs,
+ clippy::std_instead_of_alloc,
+ clippy::std_instead_of_core,
+ // lints that help writing unsafe code
+ clippy::default_union_representation,
+ clippy::trailing_empty_array,
+ clippy::transmute_undefined_repr,
+ clippy::undocumented_unsafe_blocks,
+)]
#![allow(clippy::needless_doctest_main)]
// ANDROID: Use std to allow building as a dylib.
@@ -246,7 +259,8 @@ pub mod __private {
#[doc(hidden)]
pub struct Wrapper<'a, T: ?Sized>(PhantomData<&'a ()>, T);
- unsafe impl<T: ?Sized> UnsafeUnpin for Wrapper<'_, T> where T: UnsafeUnpin {}
+ // SAFETY: `T` implements UnsafeUnpin.
+ unsafe impl<T: ?Sized + UnsafeUnpin> UnsafeUnpin for Wrapper<'_, T> {}
// This is an internal helper struct used by `pin-project-internal`.
//
@@ -269,6 +283,8 @@ pub mod __private {
impl<T: ?Sized> Drop for UnsafeDropInPlaceGuard<T> {
fn drop(&mut self) {
+ // SAFETY: the caller of `UnsafeDropInPlaceGuard::new` must guarantee
+ // that `ptr` is valid for drop when this guard is destructed.
unsafe {
ptr::drop_in_place(self.0);
}
@@ -292,6 +308,8 @@ pub mod __private {
impl<T> Drop for UnsafeOverwriteGuard<T> {
fn drop(&mut self) {
+ // SAFETY: the caller of `UnsafeOverwriteGuard::new` must guarantee
+ // that `target` is valid for writes when this guard is destructed.
unsafe {
ptr::write(self.target, ptr::read(&*self.value));
}