Skip to content

Commit 3321fde

Browse files
committed
build: Remove redundant type casting
This change is suggested by clippy. Signed-off-by: Akira Moroo <retrage01@gmail.com>
1 parent 876e3f6 commit 3321fde

File tree

2 files changed

+6
-19
lines changed

2 files changed

+6
-19
lines changed

src/efi/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,8 +586,7 @@ pub extern "efiapi" fn locate_handle(
586586

587587
let wrappers_as_handles: &[Handle] = unsafe {
588588
core::slice::from_raw_parts_mut(
589-
BLOCK_WRAPPERS.wrappers.as_mut_ptr() as *mut *mut block::BlockWrapper
590-
as *mut Handle,
589+
BLOCK_WRAPPERS.wrappers.as_mut_ptr() as *mut Handle,
591590
count,
592591
)
593592
};

src/efi/var.rs

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl VariableAllocator {
4848
return None;
4949
}
5050

51-
let s = unsafe { core::slice::from_raw_parts(name as *const u16, len + 1) };
51+
let s = unsafe { core::slice::from_raw_parts(name, len + 1) };
5252
let mut name: Vec<u16> = Vec::new();
5353
name.extend_from_slice(s);
5454
let guid = unsafe { &*guid };
@@ -118,7 +118,7 @@ impl VariableAllocator {
118118
return efi::Status::INVALID_PARAMETER;
119119
}
120120
let mut a = Descriptor::new();
121-
let name = unsafe { core::slice::from_raw_parts(name as *const u16, len + 1) };
121+
let name = unsafe { core::slice::from_raw_parts(name, len + 1) };
122122
a.name.extend_from_slice(name);
123123
a.guid = unsafe { *guid };
124124
a.attr = attr & !efi::VARIABLE_APPEND_WRITE;
@@ -225,13 +225,7 @@ mod tests {
225225

226226
let size = 0;
227227
let attr = ATTR | efi::VARIABLE_APPEND_WRITE;
228-
let status = allocator.set(
229-
NAME.as_ptr(),
230-
&GUID,
231-
attr,
232-
size,
233-
core::ptr::null() as *const core::ffi::c_void,
234-
);
228+
let status = allocator.set(NAME.as_ptr(), &GUID, attr, size, core::ptr::null());
235229

236230
assert_eq!(status, efi::Status::SUCCESS);
237231
assert_eq!(allocator.allocations[0].name, NAME);
@@ -263,13 +257,7 @@ mod tests {
263257

264258
let size = 0;
265259
let attr = ATTR;
266-
let status = allocator.set(
267-
NAME.as_ptr(),
268-
&GUID,
269-
attr,
270-
size,
271-
core::ptr::null() as *const core::ffi::c_void,
272-
);
260+
let status = allocator.set(NAME.as_ptr(), &GUID, attr, size, core::ptr::null());
273261

274262
assert_eq!(status, efi::Status::SUCCESS);
275263
assert!(allocator.allocations.is_empty());
@@ -316,7 +304,7 @@ mod tests {
316304
let status = allocator.get(
317305
NAME.as_ptr(),
318306
&GUID,
319-
core::ptr::null_mut() as *mut u32,
307+
core::ptr::null_mut(),
320308
&mut size,
321309
data.as_mut_ptr() as *mut core::ffi::c_void,
322310
);

0 commit comments

Comments
 (0)