Skip to content

Commit e783149

Browse files
committed
Auto merge of #1612 - jtgeibel:atomic-usize-new, r=sgrif
Use `AtomicUsize::new(0)` in place of deprecated `ATOMIC_USIZE_INIT` `ATOMIC_USIZE_INIT` is deprecated starting in 1.34. The new warning is causing nightly to fail on CI. For consistency, `Once::new()` is used in place of `ONCE_INIT`.
2 parents b5807ea + e54b8bb commit e783149

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

src/tests/all.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use std::{
2323
borrow::Cow,
2424
env,
2525
sync::{
26-
atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT},
26+
atomic::{AtomicUsize, Ordering},
2727
Arc,
2828
},
2929
};
@@ -200,7 +200,7 @@ where
200200
}
201201
}
202202

203-
static NEXT_GH_ID: AtomicUsize = ATOMIC_USIZE_INIT;
203+
static NEXT_GH_ID: AtomicUsize = AtomicUsize::new(0);
204204

205205
fn new_user(login: &str) -> NewUser<'_> {
206206
NewUser {

src/tests/git.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::env;
22
use std::fs;
33
use std::path::PathBuf;
4-
use std::sync::{Once, ONCE_INIT};
4+
use std::sync::Once;
55
use std::thread;
66

77
use url::Url;
@@ -21,7 +21,7 @@ pub fn bare() -> PathBuf {
2121
}
2222

2323
pub fn init() {
24-
static INIT: Once = ONCE_INIT;
24+
static INIT: Once = Once::new();
2525
let _ = fs::remove_dir_all(&checkout());
2626
let _ = fs::remove_dir_all(&bare());
2727

src/tests/team.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use crate::{
66
OwnerTeamsResponse, RequestHelper, TestApp,
77
};
88
use cargo_registry::models::{Crate, NewUser};
9-
use std::sync::ONCE_INIT;
9+
use std::sync::Once;
1010

1111
use diesel::*;
1212

@@ -25,11 +25,11 @@ impl crate::util::MockAnonymousUser {
2525

2626
static GH_USER_1: GhUser = GhUser {
2727
login: "crates-tester-1",
28-
init: ONCE_INIT,
28+
init: Once::new(),
2929
};
3030
static GH_USER_2: GhUser = GhUser {
3131
login: "crates-tester-2",
32-
init: ONCE_INIT,
32+
init: Once::new(),
3333
};
3434

3535
fn mock_user_on_only_one_team() -> NewUser<'static> {

0 commit comments

Comments
 (0)