Skip to content

Commit 9eabb90

Browse files
committed
Remove unnecessary unsafe
1 parent e9f49cb commit 9eabb90

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

.travis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,4 @@ matrix:
1515
- rust: nightly
1616

1717
os:
18-
- osx
1918
- linux

src/object.rs

+12-14
Original file line numberDiff line numberDiff line change
@@ -113,16 +113,14 @@ impl Node {
113113

114114
#[inline(always)]
115115
fn new(value: JsonValue, hash: u64, len: usize) -> Node {
116-
unsafe {
117-
Node {
118-
key_buf: mem::uninitialized(),
119-
key_len: len,
120-
key_ptr: mem::uninitialized(),
121-
key_hash: hash,
122-
value: value,
123-
left: 0,
124-
right: 0,
125-
}
116+
Node {
117+
key_buf: [0; KEY_BUF_LEN],
118+
key_len: len,
119+
key_ptr: ptr::null_mut(),
120+
key_hash: hash,
121+
value: value,
122+
left: 0,
123+
right: 0,
126124
}
127125
}
128126

@@ -602,10 +600,10 @@ impl<'a> Index<&'a str> for Object {
602600
type Output = JsonValue;
603601

604602
fn index(&self, index: &str) -> &JsonValue {
605-
match self.get(index) {
606-
Some(value) => value,
607-
_ => &NULL
608-
}
603+
match self.get(index) {
604+
Some(value) => value,
605+
_ => &NULL
606+
}
609607
}
610608
}
611609

0 commit comments

Comments
 (0)