Skip to content

Commit 2cd8cf8

Browse files
committed
fix: clippy issues
1 parent dcf9f7f commit 2cd8cf8

File tree

4 files changed

+12
-18
lines changed

4 files changed

+12
-18
lines changed

raw_struct/src/builtins/array.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,14 @@ where
104104
index: usize,
105105
) -> Result<Copy<T>, AccessError> {
106106
let offset = (index * T::MEMORY_SIZE) as u64;
107-
Ok(
108-
Copy::read_object(memory, self.start_address() + offset).map_err(|err| {
109-
AccessError {
110-
source: err,
111-
offset: self.start_address() + offset,
112-
size: T::MEMORY_SIZE,
113-
mode: AccessMode::Read,
114-
object: format!("[{}]", T::name()).into(),
115-
member: Some(format!("[{}]", index).into()),
116-
}
117-
})?,
118-
)
107+
Copy::read_object(memory, self.start_address() + offset).map_err(|err| AccessError {
108+
source: err,
109+
offset: self.start_address() + offset,
110+
size: T::MEMORY_SIZE,
111+
mode: AccessMode::Read,
112+
object: format!("[{}]", T::name()).into(),
113+
member: Some(format!("[{}]", index).into()),
114+
})
119115
}
120116

121117
pub fn elements_copy(

raw_struct/src/builtins/ptr.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ where
3333

3434
impl<T: ?Sized + 'static> Clone for Ptr64<T> {
3535
fn clone(&self) -> Self {
36-
Self {
37-
address: self.address,
38-
_dummy: Default::default(),
39-
}
36+
*self
4037
}
4138
}
4239
impl<T: ?Sized + 'static> marker::Copy for Ptr64<T> {}
@@ -51,7 +48,8 @@ impl<T: ?Sized + Viewable<T>> Ptr64<T> {
5148
}
5249
}
5350

54-
#[must_use]
51+
/// Create a copy of the value the pointer points to
52+
#[must_use = "copied result must be used"]
5553
pub fn value_copy(&self, memory: &dyn MemoryView) -> Result<Option<Copy<T>>, AccessError> {
5654
if self.address > 0 {
5755
let memory =

raw_struct/src/memory.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use alloc::boxed::Box;
12
use core::{
23
mem::{
34
self,

raw_struct/src/view.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use alloc::borrow::Cow;
2-
use core;
32

43
use crate::memory::MemoryView;
54

0 commit comments

Comments
 (0)