diff --git a/src/config.rs b/src/config.rs index d786a8f..a60f954 100644 --- a/src/config.rs +++ b/src/config.rs @@ -474,6 +474,25 @@ impl TryFrom for TlsBackend { } } +impl TlsBackend { + const fn as_raw(self) -> RawTlsBackend { + match self { + #[cfg(feature = "native-tls")] + Self::NativeTls => RawTlsBackend::NativeTls, + #[cfg(feature = "rustls-with-webpki-roots")] + Self::RustlsWithWebpkiRoots => RawTlsBackend::RustlsWithWebpkiRoots, + #[cfg(feature = "rustls-with-native-roots")] + Self::RustlsWithNativeRoots => RawTlsBackend::RustlsWithNativeRoots, + } + } +} + +impl fmt::Display for TlsBackend { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + self.as_raw().fmt(f) + } +} + #[derive(Clone, Debug, PartialEq, Eq)] pub struct Config<'a> { pub style: StyleConfig, diff --git a/src/main.rs b/src/main.rs index 0c9bc4f..1d1b5fc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -320,7 +320,7 @@ fn try_main(args: Cli, enable_styles: bool) -> Result { eprintln!(); eprintln!("Note: Update errors are often caused by unexpected or missing TLS certificates."); eprintln!( - "You are currently using the following TLS backend: {:?}", + "You are currently using the following TLS backend: {}", config.updates.tls_backend, ); eprintln!(