From 48dcb095f659da921b1b7bcd25271f3252f1b07f Mon Sep 17 00:00:00 2001 From: David Kellum Date: Sun, 3 Feb 2019 08:59:47 -0800 Subject: [PATCH] Silence deprecation warning for ATOMIC_USIZE_INIT ATOMIC_USIZE_INIT was deprecated in rust 1.34. Silence the deprecation warning until our MSRV >= 1.24, where we can use the replacement const fn `AtomicUsize::new` github: fixes #320 --- src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a051ecc..49adba4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -295,7 +295,13 @@ use std::error; use std::fmt; use std::mem; use std::str::FromStr; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +// FIXME: ATOMIC_USIZE_INIT was deprecated in rust 1.34. Silence the +// deprecation warning until our MSRV >= 1.24, where we can use the +// replacement const fn `AtomicUsize::new` +#[allow(deprecated)] +use std::sync::atomic::ATOMIC_USIZE_INIT; #[macro_use] mod macros; @@ -304,6 +310,8 @@ mod serde; // The LOGGER static holds a pointer to the global logger. It is protected by // the STATE static which determines whether LOGGER has been initialized yet. static mut LOGGER: &'static Log = &NopLogger; + +#[allow(deprecated)] static STATE: AtomicUsize = ATOMIC_USIZE_INIT; // There are three different states that we care about: the logger's @@ -313,6 +321,7 @@ const UNINITIALIZED: usize = 0; const INITIALIZING: usize = 1; const INITIALIZED: usize = 2; +#[allow(deprecated)] static MAX_LOG_LEVEL_FILTER: AtomicUsize = ATOMIC_USIZE_INIT; static LOG_LEVEL_NAMES: [&'static str; 6] = ["OFF", "ERROR", "WARN", "INFO", "DEBUG", "TRACE"];