Skip to content

Commit 9c4838e

Browse files
cpuctz
authored andcommitted
avoid std::prelude imports
This also means the panic macro isn't ambiguous so we can drop explicit panic imports.
1 parent 009ef66 commit 9c4838e

File tree

7 files changed

+17
-13
lines changed

7 files changed

+17
-13
lines changed

src/alg_tests.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414

1515
#![allow(clippy::duplicate_mod)]
1616

17-
use std::panic;
18-
use std::prelude::v1::*;
17+
use alloc::string::String;
18+
use alloc::vec::Vec;
1919

2020
use base64::{Engine as _, engine::general_purpose};
2121
use pki_types::alg_id;

src/cert.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,12 @@ impl<'a> FromDer<'a> for CrlDistributionPoint<'a> {
392392

393393
#[cfg(test)]
394394
mod tests {
395+
#[cfg(feature = "alloc")]
396+
use alloc::vec::Vec;
397+
395398
use super::*;
396399
#[cfg(feature = "alloc")]
397400
use crate::crl::RevocationReason;
398-
use std::panic;
399-
use std::prelude::v1::*;
400401

401402
#[test]
402403
// Note: cert::parse_cert is crate-local visibility, and EndEntityCert doesn't expose the

src/crl/types.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -924,8 +924,7 @@ mod tests {
924924
use std::time::Duration;
925925

926926
use pki_types::CertificateDer;
927-
use std::prelude::v1::*;
928-
use std::{panic, println};
927+
use std::println;
929928

930929
use super::*;
931930
use crate::cert::Cert;

src/der.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,8 @@ macro_rules! oid {
472472
#[cfg(test)]
473473
mod tests {
474474
use super::DerTypeId;
475-
use std::prelude::v1::*;
475+
#[cfg(feature = "alloc")]
476+
use alloc::vec::Vec;
476477

477478
#[cfg(feature = "alloc")]
478479
#[test]

src/end_entity.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,11 @@ impl<'a> Deref for EndEntityCert<'a> {
180180
#[cfg(feature = "alloc")]
181181
#[cfg(test)]
182182
mod tests {
183+
use alloc::string::ToString;
184+
183185
use super::*;
184186
use crate::test_utils;
185187
use crate::test_utils::RCGEN_SIGNATURE_ALG;
186-
use std::prelude::v1::*;
187188

188189
// This test reproduces https://github.com/rustls/webpki/issues/167 --- an
189190
// end-entity cert where the common name is a `PrintableString` rather than

src/test_utils.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#![cfg(feature = "alloc")]
2-
use std::prelude::v1::*;
1+
use alloc::string::String;
2+
use alloc::vec::Vec;
33

44
use rcgen::{CertifiedIssuer, CertifiedKey, Issuer, KeyPair, SigningKey};
55

src/verify_cert.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,16 @@ pub(crate) enum Role {
902902

903903
#[cfg(all(test, feature = "alloc", any(feature = "ring", feature = "aws-lc-rs")))]
904904
mod tests {
905+
use alloc::borrow::ToOwned;
906+
use alloc::string::{String, ToString};
907+
use std::dbg;
908+
use std::slice;
909+
905910
use super::*;
906911
use crate::test_utils;
907912
use crate::test_utils::{issuer_params, make_end_entity, make_issuer};
908913
use crate::trust_anchor::anchor_from_trusted_cert;
909914
use rcgen::{CertifiedIssuer, Issuer, KeyPair, SigningKey};
910-
use std::dbg;
911-
use std::prelude::v1::*;
912-
use std::slice;
913915

914916
#[test]
915917
fn roundtrip() {

0 commit comments

Comments
 (0)