Skip to content

Commit

Permalink
fix: false-positive for [MaybeUninit<T>; N]
Browse files Browse the repository at this point in the history
  • Loading branch information
indietyp committed Mar 28, 2023
1 parent 65eb68c commit da66e36
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion libs/deer/src/impls/core/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,13 @@ impl<'de, T: Deserialize<'de>, const N: usize> Visitor<'de> for ArrayVisitor<'de

let mut result: Result<(), ArrayAccessError> = Ok(());

// uninit_assumed_init is fine here, as `[MaybeUninit<T>; N]` as no inhabitants,
// the code shown here is also present in 1) the rust docs and 2) as an OK example in the
// clippy docs
#[allow(unsafe_code)]
#[allow(clippy::uninit_assumed_init)]
// SAFETY: this is the same as `MaybeUninit::uninit_array()`, which is still unstable
let mut array = unsafe { MaybeUninit::<[MaybeUninit<T>; N]>::uninit().assume_init() };
let mut array: [MaybeUninit<T>; N] = unsafe { MaybeUninit::uninit().assume_init() };

let mut index = 0;
let mut failed = false;
Expand Down

0 comments on commit da66e36

Please sign in to comment.