Skip to content

Commit

Permalink
acpi_tables: Fix clippy warnings related to no_std and prelude imports
Browse files Browse the repository at this point in the history
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 <rbradford@rivosinc.com>
  • Loading branch information
rbradford committed Apr 8, 2024
1 parent ca1a473 commit 925e3f8
Show file tree
Hide file tree
Showing 11 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/aml.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
1 change: 1 addition & 0 deletions src/bert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ aml_as_bytes!(BERT);
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec::Vec;

#[test]
fn test_bert() {
Expand Down
1 change: 1 addition & 0 deletions src/fadt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ impl FADTBuilder {
mod test {
use super::{FADTBuilder, Flags, PmProfile};
use crate::Aml;
use alloc::vec::Vec;

#[test]
fn test_fadt() {
Expand Down
1 change: 0 additions & 1 deletion src/hmat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//

#![crate_type = "staticlib"]
#![cfg_attr(not(test), no_std)]
#![no_std]

//! ACPI table generation.
Expand Down
1 change: 0 additions & 1 deletion src/madt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/rhct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ impl Aml for MmuNode {
#[cfg(test)]
mod tests {
use super::*;
use crate::Aml;

#[test]
fn test_rhct() {
Expand Down
1 change: 1 addition & 0 deletions src/rimt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions src/spcr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ impl SerialPortInfo {
#[cfg(test)]
mod tests {
use super::*;
use alloc::vec::Vec;

#[test]
fn test_sbi_spcr() {
Expand Down
1 change: 1 addition & 0 deletions src/tpm2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ impl Aml for Tpm2 {
mod tests {
use super::*;
use crate::gas;
use alloc::vec::Vec;

#[test]
fn test_client() {
Expand Down
1 change: 1 addition & 0 deletions src/xsdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl Aml for XSDT {
mod tests {
use super::XSDT;
use crate::Aml;
use alloc::vec::Vec;

#[test]
fn test_xsdt() {
Expand Down

0 comments on commit 925e3f8

Please sign in to comment.