lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240620021112.136667-1-ethan.twardy@gmail.com>
Date: Wed, 19 Jun 2024 21:11:08 -0500
From: "Ethan D. Twardy" <ethan.twardy@...il.com>
To: Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>,
	Wedson Almeida Filho <wedsonaf@...il.com>,
	Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Andreas Hindborg <a.hindborg@...sung.com>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Danilo Krummrich <dakr@...hat.com>,
	"Ethan D. Twardy" <ethan.twardy@...il.com>,
	rust-for-linux@...r.kernel.org (open list:RUST),
	linux-kernel@...r.kernel.org (open list)
Subject: [PATCH] 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

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

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ