Skip to content

Commit 6cd9030

Browse files
committed
cargo check passes
1 parent 258e857 commit 6cd9030

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/sys/tree.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,8 @@ impl<'treeseq> LLTree<'treeseq> {
3939
pub fn as_mut_ptr(&mut self) -> *mut tsk_tree_t {
4040
self.inner.as_mut()
4141
}
42+
43+
pub fn as_ptr(&mut self) -> *const tsk_tree_t {
44+
self.inner.as_ptr()
45+
}
4246
}

src/trees/tree.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ impl<'treeseq> Tree<'treeseq> {
3737
at: P,
3838
) -> Result<Self, TskitError> {
3939
let mut tree = Self::new(ts, flags)?;
40-
assert!(!tree.as_ptr().is_null());
41-
assert_eq!(unsafe { (*tree.as_ptr()).index }, -1);
40+
assert!(!tree.inner.as_ptr().is_null());
41+
assert_eq!(unsafe { (*tree.inner.as_ptr()).index }, -1);
4242
// SAFETY: tree is initialized and the pointer is not NULL
43-
match unsafe { ll_bindings::tsk_tree_seek(tree.as_mut_ptr(), at.into().into(), 0) } {
43+
match unsafe { ll_bindings::tsk_tree_seek(tree.inner.as_mut_ptr(), at.into().into(), 0) } {
4444
code if code < 0 => return Err(TskitError::ErrorCode { code }),
4545
_ => (),
4646
};
@@ -53,10 +53,10 @@ impl<'treeseq> Tree<'treeseq> {
5353
at: i32,
5454
) -> Result<Self, TskitError> {
5555
let mut tree = Self::new(ts, flags)?;
56-
assert!(!tree.as_ptr().is_null());
57-
assert_eq!(unsafe { (*tree.as_ptr()).index }, -1);
56+
assert!(!tree.inner.as_ptr().is_null());
57+
assert_eq!(unsafe { (*tree.inner.as_ptr()).index }, -1);
5858
// SAFETY: tree is initialized and the pointer is not NULL
59-
match unsafe { ll_bindings::tsk_tree_seek_index(tree.as_mut_ptr(), at, 0) } {
59+
match unsafe { ll_bindings::tsk_tree_seek_index(tree.inner.as_mut_ptr(), at, 0) } {
6060
code if code < 0 => return Err(TskitError::ErrorCode { code }),
6161
_ => (),
6262
};
@@ -67,11 +67,11 @@ impl<'treeseq> Tree<'treeseq> {
6767
impl<'ts> streaming_iterator::StreamingIterator for Tree<'ts> {
6868
type Item = Tree<'ts>;
6969
fn advance(&mut self) {
70-
assert!(!self.as_ptr().is_null());
70+
assert!(!self.inner.as_ptr().is_null());
7171
// SAFETY: pointer is not null.
7272
// We also know it is initialized b/c
7373
// it comes from LLTree
74-
let rv = if unsafe { *self.as_ptr() }.index == -1 {
74+
let rv = if unsafe { *self.inner.as_ptr() }.index == -1 {
7575
unsafe { ll_bindings::tsk_tree_first(self.inner.as_mut_ptr()) }
7676
} else {
7777
unsafe { ll_bindings::tsk_tree_next(self.inner.as_mut_ptr()) }
@@ -92,14 +92,14 @@ impl<'ts> streaming_iterator::StreamingIterator for Tree<'ts> {
9292

9393
impl streaming_iterator::DoubleEndedStreamingIterator for Tree<'_> {
9494
fn advance_back(&mut self) {
95-
assert!(!self.as_ptr().is_null());
95+
assert!(!self.inner.as_ptr().is_null());
9696
// SAFETY: pointer is not null.
9797
// We also know it is initialized b/c
9898
// it comes from LLTree
99-
let rv = if unsafe { *self.as_ptr() }.index == -1 {
100-
unsafe { ll_bindings::tsk_tree_last(self.as_mut_ptr()) }
99+
let rv = if unsafe { *self.inner.as_ptr() }.index == -1 {
100+
unsafe { ll_bindings::tsk_tree_last(self.inner.as_mut_ptr()) }
101101
} else {
102-
unsafe { ll_bindings::tsk_tree_prev(self.as_mut_ptr()) }
102+
unsafe { ll_bindings::tsk_tree_prev(self.inner.as_mut_ptr()) }
103103
};
104104
self.advanced = rv;
105105
if rv < 0 {

0 commit comments

Comments
 (0)