Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
parity
Mirrored projects
ink
Commits
29bd186e
Commit
29bd186e
authored
Jan 16, 2019
by
Hero Bird
Browse files
[pdsl_core] Remove unneeded storage::Vec::new_unchecked
parent
b8b92ca3
Changes
2
Hide whitespace changes
Inline
Side-by-side
pdsl_core/src/storage/collections/vec/tests.rs
View file @
29bd186e
...
...
@@ -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
(||
{
...
...
pdsl_core/src/storage/collections/vec/vec.rs
View file @
29bd186e
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment