Skip to content

Commit fc4253f

Browse files
committed
Replace NonZero::<_>::new with NonZero::new.
1 parent 3ce0218 commit fc4253f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/borrow_tracker/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub struct BorTag(NonZero<u64>);
2121

2222
impl BorTag {
2323
pub fn new(i: u64) -> Option<Self> {
24-
NonZero::<u64>::new(i).map(BorTag)
24+
NonZero::new(i).map(BorTag)
2525
}
2626

2727
pub fn get(&self) -> u64 {
@@ -184,7 +184,7 @@ impl GlobalStateInner {
184184
borrow_tracker_method,
185185
next_ptr_tag: BorTag::one(),
186186
base_ptr_tags: FxHashMap::default(),
187-
next_call_id: NonZero::<u64>::new(1).unwrap(),
187+
next_call_id: NonZero::new(1).unwrap(),
188188
protected_tags: FxHashMap::default(),
189189
tracked_pointer_tags,
190190
tracked_call_ids,
@@ -206,7 +206,7 @@ impl GlobalStateInner {
206206
if self.tracked_call_ids.contains(&call_id) {
207207
machine.emit_diagnostic(NonHaltingDiagnostic::CreatedCallId(call_id));
208208
}
209-
self.next_call_id = NonZero::<u64>::new(call_id.get() + 1).unwrap();
209+
self.next_call_id = NonZero::new(call_id.get() + 1).unwrap();
210210
FrameState { call_id, protected_tags: SmallVec::new() }
211211
}
212212

src/concurrency/sync.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ macro_rules! declare_id {
3030
impl SyncId for $name {
3131
// Panics if `id == 0`.
3232
fn from_u32(id: u32) -> Self {
33-
Self(std::num::NonZero::<u32>::new(id).unwrap())
33+
Self(std::num::NonZero::new(id).unwrap())
3434
}
3535
fn to_u32(&self) -> u32 {
3636
self.0.get()
@@ -43,7 +43,7 @@ macro_rules! declare_id {
4343
// therefore, need to shift by one when converting from an index
4444
// into a vector.
4545
let shifted_idx = u32::try_from(idx).unwrap().checked_add(1).unwrap();
46-
$name(std::num::NonZero::<u32>::new(shifted_idx).unwrap())
46+
$name(std::num::NonZero::new(shifted_idx).unwrap())
4747
}
4848
fn index(self) -> usize {
4949
// See the comment in `Self::new`.

src/shims/foreign_items.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ trait EvalContextExtPriv<'mir, 'tcx: 'mir>: crate::MiriInterpCxExt<'mir, 'tcx> {
477477
let [id, show_unnamed] = this.check_shim(abi, Abi::Rust, link_name, args)?;
478478
let id = this.read_scalar(id)?.to_u64()?;
479479
let show_unnamed = this.read_scalar(show_unnamed)?.to_bool()?;
480-
if let Some(id) = std::num::NonZero::<u64>::new(id) {
480+
if let Some(id) = std::num::NonZero::new(id) {
481481
this.print_borrow_state(AllocId(id), show_unnamed)?;
482482
}
483483
}

0 commit comments

Comments
 (0)