Skip to content

Commit

Permalink
Fix unused imports for --no-default-features (#185)
Browse files Browse the repository at this point in the history
I noticed that I got a lot of warnings when I tried running

    cargo test --no-default-features

This fixes the warnings related to imports. There are some other
warnings related to fields never being read (tested), but they can be
fixed in other PRs.
  • Loading branch information
mgeisler authored Aug 20, 2024
1 parent e6e02a3 commit 908d718
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 47 deletions.
21 changes: 11 additions & 10 deletions mls-rs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -791,16 +791,17 @@ mod tests {
};
use assert_matches::assert_matches;

use crate::{
group::{
message_processor::ProposalMessageDescription,
proposal::Proposal,
test_utils::{test_group, test_group_custom_config},
ReceivedMessage,
},
psk::{ExternalPskId, PreSharedKey},
};

#[cfg(feature = "by_ref_proposal")]
use crate::group::message_processor::ProposalMessageDescription;
#[cfg(feature = "by_ref_proposal")]
use crate::group::proposal::Proposal;
use crate::group::test_utils::test_group;
#[cfg(feature = "psk")]
use crate::group::test_utils::test_group_custom_config;
#[cfg(feature = "by_ref_proposal")]
use crate::group::ReceivedMessage;
#[cfg(feature = "psk")]
use crate::psk::{ExternalPskId, PreSharedKey};
use alloc::vec;

#[maybe_async::test(not(mls_build_async), async(mls_build_async, crate::futures_test))]
Expand Down
30 changes: 13 additions & 17 deletions mls-rs/src/group/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

use alloc::boxed::Box;
use alloc::vec;
use alloc::vec::Vec;
use core::fmt::Debug;
Expand Down Expand Up @@ -614,7 +615,7 @@ where
&self.cipher_suite_provider,
self.context(),
sender,
Content::Commit(alloc::boxed::Box::new(commit)),
Content::Commit(Box::new(commit)),
old_signer,
#[cfg(feature = "private_message")]
self.encryption_options()?.control_wire_format(sender),
Expand Down Expand Up @@ -879,46 +880,41 @@ pub(crate) mod test_utils {

#[cfg(test)]
mod tests {
use alloc::boxed::Box;

use mls_rs_core::{
error::IntoAnyError,
extension::ExtensionType,
identity::{CredentialType, IdentityProvider},
time::MlsTime,
};

use crate::{
crypto::test_utils::{test_cipher_suite_provider, TestCryptoProvider},
group::{
mls_rules::DefaultMlsRules,
test_utils::{test_group, test_group_custom},
},
mls_rules::CommitOptions,
Client,
};

#[cfg(feature = "by_ref_proposal")]
use crate::extension::ExternalSendersExt;

use crate::extension::RequiredCapabilitiesExt;
use crate::{
client::test_utils::{test_client_with_key_pkg, TEST_CIPHER_SUITE, TEST_PROTOCOL_VERSION},
client_builder::{
test_utils::TestClientConfig, BaseConfig, ClientBuilder, WithCryptoProvider,
WithIdentityProvider,
},
client_config::ClientConfig,
crypto::test_utils::TestCryptoProvider,
extension::test_utils::{TestExtension, TEST_EXTENSION_TYPE},
group::test_utils::{test_group, test_group_custom},
group::{
proposal::ProposalType,
test_utils::{test_group_custom_config, test_n_member_group},
},
identity::test_utils::get_test_signing_identity,
identity::{basic::BasicIdentityProvider, test_utils::get_test_basic_credential},
key_package::test_utils::test_key_package_message,
mls_rules::CommitOptions,
Client,
};

use crate::extension::RequiredCapabilitiesExt;
#[cfg(feature = "by_ref_proposal")]
use crate::crypto::test_utils::test_cipher_suite_provider;
#[cfg(feature = "by_ref_proposal")]
use crate::extension::ExternalSendersExt;
#[cfg(feature = "by_ref_proposal")]
use crate::group::mls_rules::DefaultMlsRules;

#[cfg(feature = "psk")]
use crate::{
Expand Down
5 changes: 2 additions & 3 deletions mls-rs/src/group/message_verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ fn signing_identity_for_new_member_proposal(

#[cfg(test)]
mod tests {
use super::*;
use crate::{
client::{
test_utils::{test_client_with_key_pkg, TEST_CIPHER_SUITE, TEST_PROTOCOL_VERSION},
Expand All @@ -226,7 +227,6 @@ mod tests {
test_utils::{test_group_custom, TestGroup},
Group, PublicMessage,
},
tree_kem::node::LeafIndex,
};
use alloc::vec;
use assert_matches::assert_matches;
Expand All @@ -250,6 +250,7 @@ mod tests {
#[cfg(feature = "by_ref_proposal")]
use alloc::boxed::Box;

#[cfg(feature = "by_ref_proposal")]
use crate::group::{
test_utils::{test_group, test_member},
Sender,
Expand All @@ -258,8 +259,6 @@ mod tests {
#[cfg(feature = "by_ref_proposal")]
use crate::identity::test_utils::get_test_signing_identity;

use super::{verify_auth_content_signature, verify_plaintext_authentication};

#[cfg_attr(not(mls_build_async), maybe_async::must_be_sync)]
async fn make_signed_plaintext(group: &mut Group<TestClientConfig>) -> PublicMessage {
group
Expand Down
27 changes: 16 additions & 11 deletions mls-rs/src/group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1898,19 +1898,12 @@ pub(crate) mod test_utils;
mod tests {
use crate::{
client::test_utils::{
test_client_with_key_pkg, test_client_with_key_pkg_custom, TestClientBuilder,
TEST_CIPHER_SUITE, TEST_CUSTOM_PROPOSAL_TYPE, TEST_PROTOCOL_VERSION,
test_client_with_key_pkg, TestClientBuilder, TEST_CIPHER_SUITE, TEST_PROTOCOL_VERSION,
},
client_builder::{test_utils::TestClientConfig, ClientBuilder, MlsConfig},
client_builder::test_utils::TestClientConfig,
crypto::test_utils::TestCryptoProvider,
group::{
mls_rules::{CommitDirection, CommitSource},
proposal_filter::{ProposalBundle, ProposalInfo},
},
identity::{
basic::BasicIdentityProvider,
test_utils::{get_test_signing_identity, BasicWithCustomProvider},
},
group::proposal_filter::ProposalInfo,
identity::test_utils::get_test_signing_identity,
key_package::test_utils::test_key_package_message,
mls_rules::CommitOptions,
tree_kem::{
Expand All @@ -1919,6 +1912,18 @@ mod tests {
},
};

#[cfg(feature = "by_ref_proposal")]
use crate::{
client::test_utils::{test_client_with_key_pkg_custom, TEST_CUSTOM_PROPOSAL_TYPE},
client_builder::{ClientBuilder, MlsConfig},
group::{
mls_rules::{CommitDirection, CommitSource},
proposal_filter::ProposalBundle,
},
identity::basic::BasicIdentityProvider,
identity::test_utils::BasicWithCustomProvider,
};

#[cfg(any(feature = "private_message", feature = "custom_proposal"))]
use crate::group::mls_rules::DefaultMlsRules;

Expand Down
1 change: 1 addition & 0 deletions mls-rs/src/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub use mls_rs_core::identity::{

#[cfg(test)]
pub(crate) mod test_utils {
#[cfg(feature = "std")]
use alloc::boxed::Box;
use alloc::vec;
use alloc::vec::Vec;
Expand Down
17 changes: 12 additions & 5 deletions mls-rs/src/tree_kem/interop_test_vectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,27 @@
// Copyright by contributors to this project.
// SPDX-License-Identifier: (Apache-2.0 OR MIT)

#[cfg(feature = "rfc_compliant")]
use alloc::vec;
use alloc::vec::Vec;
use mls_rs_codec::{MlsDecode, MlsEncode};
use mls_rs_core::crypto::{CipherSuite, CipherSuiteProvider};
#[cfg(feature = "rfc_compliant")]
use mls_rs_codec::MlsDecode;
use mls_rs_codec::MlsEncode;
#[cfg(feature = "rfc_compliant")]
use mls_rs_core::crypto::CipherSuite;
use mls_rs_core::crypto::CipherSuiteProvider;

#[cfg(feature = "rfc_compliant")]
use itertools::Itertools;

#[cfg(feature = "rfc_compliant")]
use crate::{
crypto::test_utils::try_test_cipher_suite_provider, identity::basic::BasicIdentityProvider,
};

use super::{
node::NodeVec, test_utils::TreeWithSigners, tree_validator::TreeValidator, TreeKemPublic,
};
use super::TreeKemPublic;
#[cfg(feature = "rfc_compliant")]
use super::{node::NodeVec, test_utils::TreeWithSigners, tree_validator::TreeValidator};

#[derive(serde::Serialize, serde::Deserialize, Debug, Default, Clone)]
struct ValidationTestCase {
Expand Down
4 changes: 3 additions & 1 deletion mls-rs/src/tree_kem/leaf_node_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -625,8 +625,10 @@ mod tests {

#[cfg(test)]
pub(crate) mod test_utils {
#[cfg(feature = "std")]
use alloc::boxed::Box;
use alloc::vec;
use alloc::{boxed::Box, vec::Vec};
use alloc::vec::Vec;
use mls_rs_codec::MlsEncode;
use mls_rs_core::{
error::IntoAnyError,
Expand Down

0 comments on commit 908d718

Please sign in to comment.