Use generic NonZero everywhere else.

This commit is contained in:
Markus Reiter 2024-02-19 05:57:05 +01:00
parent 36d194f561
commit 0c474acdfa
No known key found for this signature in database
GPG key ID: 245293B51702655B
3 changed files with 4 additions and 3 deletions

View file

@ -136,7 +136,7 @@ fn decode(r: &mut Reader<'_>, s: &mut S) -> Self {
arena: arena::Arena::new(),
names: fxhash::FxHashMap::default(),
strings: Vec::new(),
// Start with a base of 1 to make sure that `NonZeroU32` works.
// Start with a base of 1 to make sure that `NonZero<u32>` works.
sym_base: NonZero::new(1).unwrap(),
});
}

View file

@ -1,10 +1,10 @@
//! Helper module which helps to determine amount of threads to be used
//! during tests execution.
use std::{env, num::NonZeroUsize, thread};
use std::{env, num::NonZero, thread};
pub fn get_concurrency() -> usize {
if let Ok(value) = env::var("RUST_TEST_THREADS") {
match value.parse::<NonZeroUsize>().ok() {
match value.parse::<NonZero<usize>>().ok() {
Some(n) => n.get(),
_ => panic!("RUST_TEST_THREADS is `{value}`, should be a positive integer."),
}

View file

@ -17,6 +17,7 @@
#![unstable(feature = "test", issue = "50297")]
#![doc(test(attr(deny(warnings))))]
#![doc(rust_logo)]
#![feature(generic_nonzero)]
#![feature(rustdoc_internals)]
#![feature(internal_output_capture)]
#![feature(staged_api)]