]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
rust: tests: drop 'use crate' in bitmap and atomic KUnit tests
authorYury Norov <ynorov@nvidia.com>
Fri, 17 Apr 2026 03:15:27 +0000 (23:15 -0400)
committerMiguel Ojeda <ojeda@kernel.org>
Mon, 8 Jun 2026 00:30:33 +0000 (02:30 +0200)
The following patch makes usage of macros::kunit_tests crate conditional
on the corresponding configs. When the configs are disabled, compiler
warns on unused crate. So, embed it in unit test declaration.

Signed-off-by: Yury Norov <ynorov@nvidia.com>
Reviewed-by: David Gow <david@davidgow.net>
Acked-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260417031531.315281-2-ynorov@nvidia.com
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
rust/kernel/bitmap.rs
rust/kernel/sync/atomic/predefine.rs

index 83d7dea99137ded7cba47ec5a3bf10bb7e13f2d2..894043c9e460b37c5b8de5bde470fe68647f6cf7 100644 (file)
@@ -499,9 +499,7 @@ impl Bitmap {
     }
 }
 
-use macros::kunit_tests;
-
-#[kunit_tests(rust_kernel_bitmap)]
+#[macros::kunit_tests(rust_kernel_bitmap)]
 mod tests {
     use super::*;
     use kernel::alloc::flags::GFP_KERNEL;
index 1d53834fcb12e9911497224056e41d42508f978c..84fcd7cfcb73cd1eb57f1d59eef95e089892d3d7 100644 (file)
@@ -154,9 +154,7 @@ unsafe impl super::AtomicAdd<usize> for usize {
     }
 }
 
-use crate::macros::kunit_tests;
-
-#[kunit_tests(rust_atomics)]
+#[macros::kunit_tests(rust_atomics)]
 mod tests {
     use super::super::*;