From ef2e55108575a7cb3ea589e5a25c55ac1ec2ffdd Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Wed, 30 Apr 2025 18:08:40 -0400 Subject: [PATCH] posmap: use std::mem::swap --- src/repr/pos_map.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/repr/pos_map.rs b/src/repr/pos_map.rs index 6a2719f..be89972 100644 --- a/src/repr/pos_map.rs +++ b/src/repr/pos_map.rs @@ -14,12 +14,12 @@ impl PosMap { Self(MaybeUninit::zeroed().assume_init()) } - pub const fn from(v: [[T; Board::SIZE as usize]; Board::SIZE as usize]) -> Self { + pub const fn from(mut v: [[T; Board::SIZE as usize]; Board::SIZE as usize]) -> Self { let mut n = unsafe { Self::uninit() }; const_for!(i in 0..Board::SIZE => { const_for!(j in 0..Board::SIZE => { - n.set(CoordPair::from_axes(i, j), v[i as usize][j as usize]); + std::mem::swap(n.get_mut(CoordPair::from_axes(i, j)), &mut v[i as usize][j as usize]); }); }); n