Commit 29bd186e authored by Hero Bird's avatar Hero Bird
Browse files

[pdsl_core] Remove unneeded storage::Vec::new_unchecked

parent b8b92ca3
......@@ -43,19 +43,6 @@ fn new_filled_vec() -> storage::Vec<i32> {
vec
}
#[test]
#[should_panic]
fn new_unchecked_uninit() {
run_test(|| {
let vec = unsafe {
Vec::<i32>::new_unchecked(Key([0x42; 32]))
};
assert_eq!(vec.len(), 0);
assert_eq!(vec.is_empty(), true);
assert_eq!(vec.iter().next(), None);
})
}
#[test]
fn init() {
run_test(|| {
......
......@@ -130,24 +130,6 @@ impl<T> parity_codec::Decode for Vec<T> {
}
impl<T> Vec<T> {
/// Creates a new storage vector for the given key.
///
/// # Safety
///
/// This is an inherently unsafe operation since it does not check
/// for the storage vector's invariances, such as
///
/// - Is the storage region determined by the given key aliasing?
/// - Is the storage region correctly formatted to be used as storage vec?
///
/// Users should not use this routine directly if possible.
pub unsafe fn new_unchecked(key: Key) -> Self {
Self{
len: storage::Value::from_raw_parts(key),
cells: SyncChunk::new_unchecked(key + 1_u32),
}
}
/// Allocates a new storage vector using the given storage allocator.
///
/// # Safety
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment