rust: alloc: Fix unused import warning
Subsystems (2)
PATCH 1/1 rust: alloc: Fix unused import warning
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
rust/kernel/alloc/vec_ext.rs +2 -0
@@ -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
Signature · 1 line
2.44.2
Quoted 5 lines · Ethan D. Twardy
core::ptris 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.
We have an alternative fix (that avoids conditional compilation) for this one in the rust-fixes branch that I am planning to send to Linus this week.
https://lore.kernel.org/r/[email protected]
If that one does not fix the issue for you, please let me know!
Thanks!
Cheers,
Miguel