From a1ee8934b40e54de28a78a5d779f1748c088b408 Mon Sep 17 00:00:00 2001 From: Bradlee Speice Date: Thu, 6 Dec 2018 22:14:43 -0500 Subject: [PATCH] Fix up the clippy warnings --- examples/release_mode.rs | 2 -- examples/setup_warning.rs | 1 - src/lib.rs | 9 +++------ tests/allocations.rs | 2 -- tests/macros.rs | 1 - 5 files changed, 3 insertions(+), 12 deletions(-) diff --git a/examples/release_mode.rs b/examples/release_mode.rs index d48228a..b2a8156 100644 --- a/examples/release_mode.rs +++ b/examples/release_mode.rs @@ -1,5 +1,3 @@ - - use qadapt::allocate_panic; use qadapt::QADAPT; diff --git a/examples/setup_warning.rs b/examples/setup_warning.rs index f7e85ba..28bcb0a 100644 --- a/examples/setup_warning.rs +++ b/examples/setup_warning.rs @@ -1,6 +1,5 @@ use env_logger; - use qadapt::allocate_panic; // Note that we're missing the `#[global_allocator]` attribute diff --git a/src/lib.rs b/src/lib.rs index a835e6e..fb69128 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,10 +12,7 @@ //! for some helper macros to make working with QADAPT a bit easier. #![deny(missing_docs)] -#[macro_use] -extern crate log; - - +use log::warn; // thread_id is necessary because `std::thread::current()` panics if we have not yet // allocated a `thread_local!{}` it depends on. use thread_id; @@ -47,7 +44,7 @@ pub fn enter_protected() { return; } - if *IS_ACTIVE.read() == false { + if !*IS_ACTIVE.read() { *IS_ACTIVE.write() = true; warn!("QADAPT not initialized when using allocation guards; please verify `#[global_allocator]` is set!"); } @@ -123,7 +120,7 @@ fn alloc_immediate() -> bool { unsafe impl GlobalAlloc for QADAPT { unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - if *IS_ACTIVE.read() == false { + if !*IS_ACTIVE.read() { *IS_ACTIVE.write() = true; } diff --git a/tests/allocations.rs b/tests/allocations.rs index 3e6fb67..d279c6a 100644 --- a/tests/allocations.rs +++ b/tests/allocations.rs @@ -1,5 +1,3 @@ - - use qadapt::enter_protected; use qadapt::exit_protected; use qadapt::protection_level; diff --git a/tests/macros.rs b/tests/macros.rs index 8adaaaf..57f0ed6 100644 --- a/tests/macros.rs +++ b/tests/macros.rs @@ -1,4 +1,3 @@ - use std::io; use qadapt::allocate_panic;