Skip to content

Commit 1068b03

Browse files
committed
acpi_tables: Fix clippy warnings related to no_std and prelude imports
See - rust-lang/rust#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 <[email protected]>
1 parent ca1a473 commit 1068b03

File tree

11 files changed

+8
-5
lines changed

11 files changed

+8
-5
lines changed

src/aml.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1698,7 +1698,7 @@ impl<'a> Aml for PowerResource<'a> {
16981698
#[cfg(test)]
16991699
mod tests {
17001700
use super::*;
1701-
use std::vec;
1701+
use alloc::borrow::ToOwned;
17021702

17031703
#[test]
17041704
fn test_device() {

src/bert.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ aml_as_bytes!(BERT);
6363
#[cfg(test)]
6464
mod tests {
6565
use super::*;
66+
use alloc::vec::Vec;
6667

6768
#[test]
6869
fn test_bert() {

src/fadt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ impl FADTBuilder {
247247
mod test {
248248
use super::{FADTBuilder, Flags, PmProfile};
249249
use crate::Aml;
250+
use alloc::vec::Vec;
250251

251252
#[test]
252253
fn test_fadt() {

src/hmat.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,6 @@ impl Aml for MemorySideCache {
357357
#[cfg(test)]
358358
mod tests {
359359
use super::*;
360-
use crate::Aml;
361360

362361
fn check_checksum(hmat: &HMAT) {
363362
let mut bytes = Vec::new();

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//
66

77
#![crate_type = "staticlib"]
8-
#![cfg_attr(not(test), no_std)]
8+
#![no_std]
99

1010
//! ACPI table generation.
1111

src/madt.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,6 @@ aml_as_bytes!(PLIC);
649649
#[cfg(test)]
650650
mod tests {
651651
use super::*;
652-
use crate::Aml;
653652

654653
fn check_checksum(madt: &MADT) {
655654
let mut bytes = Vec::new();

src/rhct.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ impl Aml for MmuNode {
335335
#[cfg(test)]
336336
mod tests {
337337
use super::*;
338-
use crate::Aml;
339338

340339
#[test]
341340
fn test_rhct() {

src/rimt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,7 @@ impl Aml for Platform {
493493
#[cfg(test)]
494494
mod tests {
495495
use super::*;
496+
use alloc::vec;
496497

497498
fn rimt() -> RIMT {
498499
RIMT::new(*b"FOOBAR", *b"CAFEDEAD", 0xdead_beef)

src/spcr.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ impl SerialPortInfo {
168168
#[cfg(test)]
169169
mod tests {
170170
use super::*;
171+
use alloc::vec::Vec;
171172

172173
#[test]
173174
fn test_sbi_spcr() {

src/tpm2.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ impl Aml for Tpm2 {
306306
mod tests {
307307
use super::*;
308308
use crate::gas;
309+
use alloc::vec::Vec;
309310

310311
#[test]
311312
fn test_client() {

src/xsdt.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ impl Aml for XSDT {
7474
mod tests {
7575
use super::XSDT;
7676
use crate::Aml;
77+
use alloc::vec::Vec;
7778

7879
#[test]
7980
fn test_xsdt() {

0 commit comments

Comments
 (0)