Skip to content

Commit

Permalink
common: remove warning on maybe uninit
Browse files Browse the repository at this point in the history
  • Loading branch information
luojia65 committed Oct 10, 2022
1 parent 365c3f2 commit c209a72
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
11 changes: 0 additions & 11 deletions common/src/flash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,6 @@ impl Meta {
dtb: MetaEntry::DEFAULT,
};

/// 构造一个未初始化的 flash 元数据。
///
/// # Safety
///
/// 生成的对象具有随机初始值。
#[inline]
pub const unsafe fn uninit() -> Self {
#[allow(clippy::uninit_assumed_init)]
core::mem::MaybeUninit::uninit().assume_init()
}

read_payload!(see);
read_payload!(kernel);
read_payload!(dtb);
Expand Down
2 changes: 1 addition & 1 deletion spl/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ extern "C" fn main() -> usize {
}
let _ = Out << Endl;
// 读取 meta
let mut meta = unsafe { FlashMeta::uninit() };
let mut meta = FlashMeta::DEFAULT;
flash.copy_into(META_POS, meta.as_buf());
// 如果 see 不存在,停在此阶段
let (see_pos, see_len) = match meta.see() {
Expand Down

0 comments on commit c209a72

Please sign in to comment.