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 4b94af9
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 @@ -1697,8 +1697,8 @@ impl<'a> Aml for PowerResource<'a> {

#[cfg(test)]
mod tests {
use alloc::borrow::ToOwned;
use super::*;
use std::vec;

#[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 @@ -62,6 +62,7 @@ aml_as_bytes!(BERT);

#[cfg(test)]
mod tests {
use alloc::vec::Vec;
use super::*;

#[test]
Expand Down
1 change: 1 addition & 0 deletions src/fadt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ impl FADTBuilder {

#[cfg(test)]
mod test {
use alloc::vec::Vec;
use super::{FADTBuilder, Flags, PmProfile};
use crate::Aml;

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 @@ -492,6 +492,7 @@ impl Aml for Platform {

#[cfg(test)]
mod tests {
use alloc::vec;
use super::*;

fn rimt() -> RIMT {
Expand Down
1 change: 1 addition & 0 deletions src/spcr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ impl SerialPortInfo {

#[cfg(test)]
mod tests {
use alloc::vec::Vec;
use super::*;

#[test]
Expand Down
1 change: 1 addition & 0 deletions src/tpm2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ impl Aml for Tpm2 {

#[cfg(test)]
mod tests {
use alloc::vec::Vec;
use super::*;
use crate::gas;

Expand Down
1 change: 1 addition & 0 deletions src/xsdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl Aml for XSDT {

#[cfg(test)]
mod tests {
use alloc::vec::Vec;
use super::XSDT;
use crate::Aml;

Expand Down

0 comments on commit 4b94af9

Please sign in to comment.