[PATCH] rust: alloc: Fix unused import warning

From: Ethan D. Twardy
Date: Wed Jun 19 2024 - 22:11:44 EST


core::ptr is only used in code that's not compiled during test, which
causes rustc to emit the below warning while building the rusttest
target. Add a conditional attribute to match conditions at the usage
site.

warning: unused import: `core::ptr`
--> rust/kernel/alloc/vec_ext.rs:7:5
|
7 | use core::ptr;
| ^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default

Signed-off-by: Ethan D. Twardy <ethan.twardy@xxxxxxxxx>

diff --git a/rust/kernel/alloc/vec_ext.rs b/rust/kernel/alloc/vec_ext.rs
index e9a81052728a..96d7cbff96dd 100644
--- a/rust/kernel/alloc/vec_ext.rs
+++ b/rust/kernel/alloc/vec_ext.rs
@@ -4,6 +4,8 @@

use super::{AllocError, Flags};
use alloc::vec::Vec;
+
+#[cfg(not(any(test, testlib)))]
use core::ptr;

/// Extensions to [`Vec`].

base-commit: 39e6bf7394d852b17fb083a85fee5890b445908c
--
2.44.2