Skip to content

Commit

Permalink
lib: clean up no_std and use of std in test code
Browse files Browse the repository at this point in the history
Like we just did in Rustls and webpki, _always_ opt-in to no_std, and
then import the std prelude in tests where necessary.

This resolves some nightly clippy warnings about redundant imports that
will arise otherwise
  • Loading branch information
cpu committed Mar 1, 2024
1 parent e2d220a commit fc3414f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
unused_extern_crates,
unused_qualifications
)]
#![cfg_attr(not(test), no_std)]
#![no_std]

extern crate alloc;
#[cfg(all(feature = "std", not(test)))]
#[cfg(any(feature = "std", test))]
extern crate std;

#[cfg(test)]
Expand Down
3 changes: 3 additions & 0 deletions src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#[cfg(test)]
mod unit {
use alloc::{format, vec};
use std::prelude::v1::*;

use crate::{Error, Item};

#[test]
Expand Down

0 comments on commit fc3414f

Please sign in to comment.