interpreter: address new lints

This commit is contained in:
Edward Amsden 2023-09-06 10:18:43 -05:00
parent de88edcda5
commit 576b511065
4 changed files with 13 additions and 20 deletions

View File

@ -171,11 +171,7 @@ impl<T: Copy> Copy for Stem<T> {}
impl<T: Copy> Clone for Stem<T> {
fn clone(&self) -> Self {
Stem {
bitmap: self.bitmap,
typemap: self.typemap,
buffer: self.buffer,
}
*self
}
}
@ -231,10 +227,7 @@ impl<T: Copy> Copy for Leaf<T> {}
impl<T: Copy> Clone for Leaf<T> {
fn clone(&self) -> Self {
Leaf {
len: self.len,
buffer: self.buffer,
}
*self
}
}

View File

@ -274,13 +274,13 @@ impl NockStack {
let alloc = *self.prev_alloc_pointer_pointer();
*(self.prev_alloc_pointer_pointer()) =
(*(self.prev_alloc_pointer_pointer())).add(words + 2);
alloc as *mut u64
alloc
}
unsafe fn indirect_alloc_in_previous_frame_east(&mut self, words: usize) -> *mut u64 {
*(self.prev_alloc_pointer_pointer()) =
(*(self.prev_alloc_pointer_pointer())).sub(words + 2);
*self.prev_alloc_pointer_pointer() as *mut u64
*self.prev_alloc_pointer_pointer()
}
/** Allocate space for an indirect atom in the previous stack frame. This call pre_copy()
@ -513,9 +513,9 @@ impl NockStack {
}
pub unsafe fn frame_pop(&mut self) {
let prev_frame_ptr = *self.prev_frame_pointer_pointer() as *mut u64;
let prev_stack_ptr = *self.prev_stack_pointer_pointer() as *mut u64;
let prev_alloc_ptr = *self.prev_alloc_pointer_pointer() as *mut u64;
let prev_frame_ptr = *self.prev_frame_pointer_pointer();
let prev_stack_ptr = *self.prev_stack_pointer_pointer();
let prev_alloc_ptr = *self.prev_alloc_pointer_pointer();
self.frame_pointer = prev_frame_ptr;
self.stack_pointer = prev_stack_ptr;

View File

@ -91,7 +91,7 @@ impl Newt {
Either::Left(direct) => unsafe {
copy_nonoverlapping(
&direct.data() as *const u64 as *const u8,
buf.as_mut_ptr().add(5) as *mut u8,
buf.as_mut_ptr().add(5),
size,
);
},
@ -99,7 +99,7 @@ impl Newt {
// REVIEW: is this safe/the right way to do this?
copy_nonoverlapping(
indirect.data_pointer() as *const u8,
buf.as_mut_ptr().add(5) as *mut u8,
buf.as_mut_ptr().add(5),
size,
);
},

View File

@ -373,11 +373,11 @@ impl IndirectAtom {
/** Pointer to data for indirect atom */
pub fn data_pointer(&self) -> *const u64 {
unsafe { self.to_raw_pointer().add(2) as *const u64 }
unsafe { self.to_raw_pointer().add(2) }
}
pub fn data_pointer_mut(&mut self) -> *mut u64 {
unsafe { self.to_raw_pointer_mut().add(2) as *mut u64 }
unsafe { self.to_raw_pointer_mut().add(2) }
}
pub fn as_slice(&self) -> &[u64] {
@ -756,11 +756,11 @@ impl Allocated {
}
pub unsafe fn get_metadata(&self) -> u64 {
*(self.to_raw_pointer() as *const u64)
*(self.to_raw_pointer())
}
pub unsafe fn set_metadata(self, metadata: u64) {
*(self.const_to_raw_pointer_mut() as *mut u64) = metadata;
*(self.const_to_raw_pointer_mut()) = metadata;
}
pub fn as_either(&self) -> Either<IndirectAtom, Cell> {