From 1068b03bbabce3ce35c61d6454a663105c23f8f4 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Mon, 8 Apr 2024 10:45:37 +0100 Subject: [PATCH] acpi_tables: Fix clippy warnings related to no_std and prelude imports See - https://github.com/rust-lang/rust/issues/121362 the recommendation for how for no_std libraries has changed. To avoid warnings around unncessary imports (due to the prelude when compiling tests) make the tests also no_std and explicitly import the require test dependencies. Signed-off-by: Rob Bradford --- src/aml.rs | 2 +- src/bert.rs | 1 + src/fadt.rs | 1 + src/hmat.rs | 1 - src/lib.rs | 2 +- src/madt.rs | 1 - src/rhct.rs | 1 - src/rimt.rs | 1 + src/spcr.rs | 1 + src/tpm2.rs | 1 + src/xsdt.rs | 1 + 11 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/aml.rs b/src/aml.rs index 18f792e..b33f0c4 100644 --- a/src/aml.rs +++ b/src/aml.rs @@ -1698,7 +1698,7 @@ impl<'a> Aml for PowerResource<'a> { #[cfg(test)] mod tests { use super::*; - use std::vec; + use alloc::borrow::ToOwned; #[test] fn test_device() { diff --git a/src/bert.rs b/src/bert.rs index e527fc3..123476b 100644 --- a/src/bert.rs +++ b/src/bert.rs @@ -63,6 +63,7 @@ aml_as_bytes!(BERT); #[cfg(test)] mod tests { use super::*; + use alloc::vec::Vec; #[test] fn test_bert() { diff --git a/src/fadt.rs b/src/fadt.rs index 3820995..d78a31e 100644 --- a/src/fadt.rs +++ b/src/fadt.rs @@ -247,6 +247,7 @@ impl FADTBuilder { mod test { use super::{FADTBuilder, Flags, PmProfile}; use crate::Aml; + use alloc::vec::Vec; #[test] fn test_fadt() { diff --git a/src/hmat.rs b/src/hmat.rs index 8c3baf6..5098132 100644 --- a/src/hmat.rs +++ b/src/hmat.rs @@ -357,7 +357,6 @@ impl Aml for MemorySideCache { #[cfg(test)] mod tests { use super::*; - use crate::Aml; fn check_checksum(hmat: &HMAT) { let mut bytes = Vec::new(); diff --git a/src/lib.rs b/src/lib.rs index 1440480..91722e1 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,7 +5,7 @@ // #![crate_type = "staticlib"] -#![cfg_attr(not(test), no_std)] +#![no_std] //! ACPI table generation. diff --git a/src/madt.rs b/src/madt.rs index edbc2be..a24eec4 100644 --- a/src/madt.rs +++ b/src/madt.rs @@ -649,7 +649,6 @@ aml_as_bytes!(PLIC); #[cfg(test)] mod tests { use super::*; - use crate::Aml; fn check_checksum(madt: &MADT) { let mut bytes = Vec::new(); diff --git a/src/rhct.rs b/src/rhct.rs index 7d4ac8a..507f575 100644 --- a/src/rhct.rs +++ b/src/rhct.rs @@ -335,7 +335,6 @@ impl Aml for MmuNode { #[cfg(test)] mod tests { use super::*; - use crate::Aml; #[test] fn test_rhct() { diff --git a/src/rimt.rs b/src/rimt.rs index 839df9a..edeb92f 100644 --- a/src/rimt.rs +++ b/src/rimt.rs @@ -493,6 +493,7 @@ impl Aml for Platform { #[cfg(test)] mod tests { use super::*; + use alloc::vec; fn rimt() -> RIMT { RIMT::new(*b"FOOBAR", *b"CAFEDEAD", 0xdead_beef) diff --git a/src/spcr.rs b/src/spcr.rs index db0d44a..ae6d1cd 100644 --- a/src/spcr.rs +++ b/src/spcr.rs @@ -168,6 +168,7 @@ impl SerialPortInfo { #[cfg(test)] mod tests { use super::*; + use alloc::vec::Vec; #[test] fn test_sbi_spcr() { diff --git a/src/tpm2.rs b/src/tpm2.rs index c21de4e..51f36a4 100644 --- a/src/tpm2.rs +++ b/src/tpm2.rs @@ -306,6 +306,7 @@ impl Aml for Tpm2 { mod tests { use super::*; use crate::gas; + use alloc::vec::Vec; #[test] fn test_client() { diff --git a/src/xsdt.rs b/src/xsdt.rs index 0eb5b59..6c7a373 100644 --- a/src/xsdt.rs +++ b/src/xsdt.rs @@ -74,6 +74,7 @@ impl Aml for XSDT { mod tests { use super::XSDT; use crate::Aml; + use alloc::vec::Vec; #[test] fn test_xsdt() {