Skip to content

Commit 5f583a3

Browse files
committed
Merge tag 'rust-fixes-6.10' of https://github.com/Rust-for-Linux/linux
Pull rust fix from Miguel Ojeda: - Avoid unused import warning in 'rusttest'. * tag 'rust-fixes-6.10' of https://github.com/Rust-for-Linux/linux: rust: avoid unused import warning in `rusttest`
2 parents 2765de9 + a126eca commit 5f583a3

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

rust/kernel/alloc/vec_ext.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
55
use super::{AllocError, Flags};
66
use alloc::vec::Vec;
7-
use core::ptr;
87

98
/// Extensions to [`Vec`].
109
pub trait VecExt<T>: Sized {
@@ -141,7 +140,11 @@ impl<T> VecExt<T> for Vec<T> {
141140
// `krealloc_aligned`. A `Vec<T>`'s `ptr` value is not guaranteed to be NULL and might be
142141
// dangling after being created with `Vec::new`. Instead, we can rely on `Vec<T>`'s capacity
143142
// to be zero if no memory has been allocated yet.
144-
let ptr = if cap == 0 { ptr::null_mut() } else { old_ptr };
143+
let ptr = if cap == 0 {
144+
core::ptr::null_mut()
145+
} else {
146+
old_ptr
147+
};
145148

146149
// SAFETY: `ptr` is valid because it's either NULL or comes from a previous call to
147150
// `krealloc_aligned`. We also verified that the type is not a ZST.

0 commit comments

Comments
 (0)