impl Display for TlsBackend

This commit is contained in:
Niklas Mohrin 2026-02-21 00:14:39 +01:00
commit 9d93da0540
No known key found for this signature in database
GPG key ID: 0ACD89A5C1DEB3EB
2 changed files with 20 additions and 1 deletions

View file

@ -474,6 +474,25 @@ impl TryFrom<RawTlsBackend> 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,

View file

@ -320,7 +320,7 @@ fn try_main(args: Cli, enable_styles: bool) -> Result<ExitCode> {
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!(