1
+ #[ cfg( feature = "rustls-native-certs" ) ]
2
+ use std:: io;
1
3
#[ cfg( feature = "rustls-platform-verifier" ) ]
2
4
use std:: sync:: Arc ;
3
5
@@ -30,9 +32,7 @@ pub trait ConfigBuilderExt {
30
32
/// This will return an error if no valid certs were found. In that case,
31
33
/// it's recommended to use `with_webpki_roots`.
32
34
#[ 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 > ;
36
36
37
37
/// This configures the webpki roots, which are Mozilla's set of
38
38
/// trusted roots as packaged by webpki-roots.
@@ -51,9 +51,7 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
51
51
52
52
#[ cfg( feature = "rustls-native-certs" ) ]
53
53
#[ 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 > {
57
55
let mut roots = rustls:: RootCertStore :: empty ( ) ;
58
56
let mut valid_count = 0 ;
59
57
let mut invalid_count = 0 ;
@@ -64,8 +62,8 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
64
62
}
65
63
66
64
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 ,
69
67
"no native root CA certificates found (errors: {errors})" ,
70
68
) ) ;
71
69
}
@@ -87,8 +85,8 @@ impl ConfigBuilderExt for ConfigBuilder<ClientConfig, WantsVerifier> {
87
85
) ;
88
86
if roots. is_empty ( ) {
89
87
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 ,
92
90
format ! ( "no valid native root CA certificates found ({invalid_count} invalid)" ) ,
93
91
) ) ?
94
92
}
0 commit comments