dfinity / cdk-rs

Rust canister development kit for the Internet Computer.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unsafe block in ic-cdk storage violates code quality policy

andrew-lee-work opened this issue · comments

  • There should be an explanation of why this is safe. If unsafe, it needs an explanation of how to use it safely, and it should be marked as unsafe at the interface level.
  • It should also include an explanation of why the unsafe block is necessary.

fn storage() -> &'static mut StorageTree {
unsafe {
if let Some(s) = &mut STORAGE {
s
} else {
STORAGE = Some(BTreeMap::new());
storage()
}
}
}

Fixed in #215.