Skip to content

Commit

Permalink
tests: fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
y86-dev committed Apr 20, 2024
1 parent 3799b8b commit 3367b99
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 5 deletions.
2 changes: 0 additions & 2 deletions examples/big_struct_in_place.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![feature(allocator_api)]

use std::convert::Infallible;

use pinned_init::*;

// Struct with size over 1GiB
Expand Down
2 changes: 2 additions & 0 deletions examples/error.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(unused_attributes)]
#![feature(allocator_api)]

use core::convert::Infallible;
Expand All @@ -18,4 +19,5 @@ impl From<AllocError> for Error {
}
}

#[allow(dead_code)]
fn main() {}
4 changes: 4 additions & 0 deletions examples/mutex.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![allow(unused_attributes)]
#![feature(allocator_api)]

use core::{
cell::{Cell, UnsafeCell},
marker::PhantomPinned,
Expand All @@ -16,6 +18,7 @@ use pinned_init::*;
#[allow(unused_attributes)]
#[path = "./linked_list.rs"]
pub mod linked_list;
#[allow(unused_imports)]
pub use linked_list::Error;
use linked_list::*;

Expand Down Expand Up @@ -100,6 +103,7 @@ impl<T> CMutex<T> {
}
}

#[allow(dead_code)]
pub fn get_data_mut(self: Pin<&mut Self>) -> &mut T {
// SAFETY: we have an exclusive reference and thus nobody has access to data.
unsafe { &mut *self.data.get() }
Expand Down
2 changes: 2 additions & 0 deletions examples/pthread_mutex.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// inspired by https://github.com/nbdd0121/pin-init/blob/trunk/examples/pthread_mutex.rs
#![allow(dead_code)]
#![feature(allocator_api)]

#[cfg(not(windows))]
mod pthread_mtx {
use core::{
Expand Down
2 changes: 1 addition & 1 deletion tests/alloc_fail.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![feature(allocator_api)]

use core::{alloc::AllocError, convert::Infallible};
use core::alloc::AllocError;
use pinned_init::*;
use std::sync::Arc;

Expand Down
2 changes: 0 additions & 2 deletions tests/const-generic-default.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std::convert::Infallible;

use pinned_init::*;

#[pin_data]
Expand Down
1 change: 1 addition & 0 deletions tests/many_generics.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
use core::{marker::PhantomPinned, pin::Pin};
use pinned_init::*;

Expand Down
2 changes: 2 additions & 0 deletions tests/ring_buf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#![allow(unused_attributes)]
#![feature(allocator_api)]

use core::{
alloc::AllocError,
convert::Infallible,
Expand Down
1 change: 1 addition & 0 deletions tests/ui/expand/many_generics.expanded.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
use core::{marker::PhantomPinned, pin::Pin};
use pinned_init::*;
trait Bar<'a, const ID: usize = 0> {
Expand Down
1 change: 1 addition & 0 deletions tests/zeroing.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![allow(dead_code)]
use std::{marker::PhantomPinned, ptr::addr_of_mut};

use pinned_init::*;
Expand Down

0 comments on commit 3367b99

Please sign in to comment.