Skip to content

Commit 8ab89f1

Browse files
committed
Import std::io directly
1 parent fc884cd commit 8ab89f1

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

Diff for: src/config.rs

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#[cfg(feature = "rustls-native-certs")]
2+
use std::io;
13
#[cfg(feature = "rustls-platform-verifier")]
24
use std::sync::Arc;
35

@@ -30,9 +32,7 @@ pub trait ConfigBuilderExt {
3032
/// This will return an error if no valid certs were found. In that case,
3133
/// it's recommended to use `with_webpki_roots`.
3234
#[cfg(feature = "rustls-native-certs")]
33-
fn with_native_roots(
34-
self,
35-
) -> Result<ConfigBuilder<ClientConfig, WantsClientCert>, std::io::Error>;
35+
fn with_native_roots(self) -> Result<ConfigBuilder<ClientConfig, WantsClientCert>, io::Error>;
3636

3737
/// This configures the webpki roots, which are Mozilla's set of
3838
/// trusted roots as packaged by webpki-roots.
@@ -51,9 +51,7 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
5151

5252
#[cfg(feature = "rustls-native-certs")]
5353
#[cfg_attr(not(feature = "logging"), allow(unused_variables))]
54-
fn with_native_roots(
55-
self,
56-
) -> Result<ConfigBuilder<ClientConfig, WantsClientCert>, std::io::Error> {
54+
fn with_native_roots(self) -> Result<ConfigBuilder<ClientConfig, WantsClientCert>, io::Error> {
5755
let mut roots = rustls::RootCertStore::empty();
5856
let mut valid_count = 0;
5957
let mut invalid_count = 0;
@@ -64,8 +62,8 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
6462
}
6563

6664
if certs.is_empty() {
67-
return Err(std::io::Error::new(
68-
std::io::ErrorKind::NotFound,
65+
return Err(io::Error::new(
66+
io::ErrorKind::NotFound,
6967
"no native root CA certificates found (errors: {errors})",
7068
));
7169
}
@@ -87,8 +85,8 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
8785
);
8886
if roots.is_empty() {
8987
crate::log::debug!("no valid native root CA certificates found");
90-
Err(std::io::Error::new(
91-
std::io::ErrorKind::NotFound,
88+
Err(io::Error::new(
89+
io::ErrorKind::NotFound,
9290
format!("no valid native root CA certificates found ({invalid_count} invalid)"),
9391
))?
9492
}

0 commit comments

Comments
 (0)