Fix some nightly warnings (#5093)

ONCE_INIT => Once::new
Box<Error> => Box<dyn Error>
This commit is contained in:
sakridge
2019-07-14 13:37:55 -07:00
committed by GitHub
parent 440d006ec1
commit 9b54528c8e
5 changed files with 13 additions and 13 deletions

View File

@@ -62,7 +62,7 @@ macro_rules! inc_new_counter {
if log_enabled!($level) {
static mut INC_NEW_COUNTER: $crate::counter::Counter =
create_counter!($name, $lograte, $metricsrate);
static INIT_HOOK: std::sync::Once = std::sync::ONCE_INIT;
static INIT_HOOK: std::sync::Once = std::sync::Once::new();
unsafe {
INIT_HOOK.call_once(|| {
INC_NEW_COUNTER.init();
@@ -197,11 +197,11 @@ mod tests {
use serial_test_derive::serial;
use std::env;
use std::sync::atomic::Ordering;
use std::sync::{Once, RwLock, ONCE_INIT};
use std::sync::{Once, RwLock};
fn get_env_lock() -> &'static RwLock<()> {
static mut ENV_LOCK: Option<RwLock<()>> = None;
static INIT_HOOK: Once = ONCE_INIT;
static INIT_HOOK: Once = Once::new();
unsafe {
INIT_HOOK.call_once(|| {

View File

@@ -8,7 +8,7 @@ use solana_sdk::hash::hash;
use solana_sdk::timing;
use std::collections::HashMap;
use std::sync::mpsc::{channel, Receiver, RecvTimeoutError, Sender};
use std::sync::{Arc, Barrier, Mutex, Once, ONCE_INIT};
use std::sync::{Arc, Barrier, Mutex, Once};
use std::thread;
use std::time::{Duration, Instant};
use std::{cmp, env};
@@ -379,7 +379,7 @@ impl Drop for MetricsAgent {
}
fn get_singleton_agent() -> Arc<Mutex<MetricsAgent>> {
static INIT: Once = ONCE_INIT;
static INIT: Once = Once::new();
static mut AGENT: Option<Arc<Mutex<MetricsAgent>>> = None;
unsafe {
INIT.call_once(|| AGENT = Some(Arc::new(Mutex::new(MetricsAgent::default()))));
@@ -430,7 +430,7 @@ pub fn flush() {
/// Hook the panic handler to generate a data point on each panic
pub fn set_panic_hook(program: &'static str) {
use std::panic;
static SET_HOOK: Once = ONCE_INIT;
static SET_HOOK: Once = Once::new();
SET_HOOK.call_once(|| {
let default_hook = panic::take_hook();
panic::set_hook(Box::new(move |ono| {