From ca0a0afd2252163558d6c882b4bfee845b1f51e7 Mon Sep 17 00:00:00 2001 From: Lzu Tao Date: Thu, 13 Jun 2019 12:54:23 +0700 Subject: [PATCH] Use Once::new instead of ONCE_INIT --- src/cargo/util/config.rs | 4 ++-- tests/testsuite/support/cross_compile.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/cargo/util/config.rs b/src/cargo/util/config.rs index f0bd5018e44..44628ee9038 100644 --- a/src/cargo/util/config.rs +++ b/src/cargo/util/config.rs @@ -10,7 +10,7 @@ use std::io::{self, SeekFrom}; use std::mem; use std::path::{Path, PathBuf}; use std::str::FromStr; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; use std::time::Instant; use std::vec; @@ -89,7 +89,7 @@ pub struct Config { impl Config { pub fn new(shell: Shell, cwd: PathBuf, homedir: PathBuf) -> Config { static mut GLOBAL_JOBSERVER: *mut jobserver::Client = 0 as *mut _; - static INIT: Once = ONCE_INIT; + static INIT: Once = Once::new(); // This should be called early on in the process, so in theory the // unsafety is ok here. (taken ownership of random fds) diff --git a/tests/testsuite/support/cross_compile.rs b/tests/testsuite/support/cross_compile.rs index c22d8fd07e8..ac072822dba 100644 --- a/tests/testsuite/support/cross_compile.rs +++ b/tests/testsuite/support/cross_compile.rs @@ -1,7 +1,7 @@ use std::env; use std::process::Command; use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Once, ONCE_INIT}; +use std::sync::Once; use crate::support::{basic_bin_manifest, main_file, project}; @@ -23,7 +23,7 @@ pub fn disabled() -> bool { // try to detect that before we fail a bunch of tests through no fault // of the user. static CAN_RUN_CROSS_TESTS: AtomicBool = AtomicBool::new(false); - static CHECK: Once = ONCE_INIT; + static CHECK: Once = Once::new(); let cross_target = alternate();