From af823ea16cc4619fd02308b3ddcedc53bd2768df Mon Sep 17 00:00:00 2001 From: Jelte Fennema-Nio Date: Fri, 12 Jul 2024 10:14:19 +0200 Subject: [PATCH] Remove unused imports for no_std tests (#385) When running no_std tests I realised there were warnings. This removes all of them and configures CI to complain when this happens next. --- ci/test_all_features.sh | 2 +- tests/debug.rs | 2 +- tests/deref_mut.rs | 2 +- tests/display.rs | 7 +------ 4 files changed, 4 insertions(+), 9 deletions(-) diff --git a/ci/test_all_features.sh b/ci/test_all_features.sh index 9357d570..ada63e50 100755 --- a/ci/test_all_features.sh +++ b/ci/test_all_features.sh @@ -8,5 +8,5 @@ fi set -euxo pipefail for feature in $(tomljson Cargo.toml | jq --raw-output '.features | keys[]' | grep -v 'default\|std\|full\|testing-helpers'); do - cargo +nightly test -p derive_more --tests --no-default-features --features "$feature$std,testing-helpers" + RUSTFLAGS='-D warnings' cargo +nightly test -p derive_more --tests --no-default-features --features "$feature$std,testing-helpers" done diff --git a/tests/debug.rs b/tests/debug.rs index 15e7f12f..bc6b6132 100644 --- a/tests/debug.rs +++ b/tests/debug.rs @@ -1918,7 +1918,7 @@ mod generic { // See: https://github.com/JelteF/derive_more/issues/301 mod complex_enum_syntax { #[cfg(not(feature = "std"))] - use alloc::{boxed::Box, format}; + use alloc::format; use derive_more::Debug; diff --git a/tests/deref_mut.rs b/tests/deref_mut.rs index dab6733f..635f63b6 100644 --- a/tests/deref_mut.rs +++ b/tests/deref_mut.rs @@ -5,7 +5,7 @@ extern crate alloc; #[cfg(not(feature = "std"))] -use alloc::{boxed::Box, format, vec, vec::Vec}; +use alloc::{boxed::Box, vec, vec::Vec}; use derive_more::DerefMut; diff --git a/tests/display.rs b/tests/display.rs index 1e7ddfc1..7ae52f61 100644 --- a/tests/display.rs +++ b/tests/display.rs @@ -5,12 +5,7 @@ extern crate alloc; #[cfg(not(feature = "std"))] -use alloc::{ - boxed::Box, - format, - string::{String, ToString}, - vec::Vec, -}; +use alloc::{format, string::ToString}; use derive_more::{ Binary, Display, LowerExp, LowerHex, Octal, Pointer, UpperExp, UpperHex,