From 5c7b1ab4ab67d2a6ee04ed0f8b3fb10610dc555d Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Thu, 6 Mar 2025 15:20:33 +0100 Subject: [PATCH] tfa, auth-api: simplify and restyle Display implementation Signed-off-by: Wolfgang Bumiller --- proxmox-auth-api/src/ticket.rs | 8 ++++---- proxmox-tfa/src/api/webauthn.rs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/proxmox-auth-api/src/ticket.rs b/proxmox-auth-api/src/ticket.rs index df6c4eb6..35059984 100644 --- a/proxmox-auth-api/src/ticket.rs +++ b/proxmox-auth-api/src/ticket.rs @@ -1,7 +1,7 @@ //! Generate and verify Authentication tickets use std::borrow::Cow; -use std::fmt::Display; +use std::fmt; use std::marker::PhantomData; use anyhow::{bail, format_err, Error}; @@ -19,9 +19,9 @@ const TICKET_ASCIISET: &AsciiSet = &percent_encoding::CONTROLS.add(b':'); /// with no data. pub struct Empty; -impl Display for Empty { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "") +impl fmt::Display for Empty { + fn fmt(&self, _f: &mut fmt::Formatter<'_>) -> fmt::Result { + Ok(()) } } diff --git a/proxmox-tfa/src/api/webauthn.rs b/proxmox-tfa/src/api/webauthn.rs index 7e04c328..90cb0208 100644 --- a/proxmox-tfa/src/api/webauthn.rs +++ b/proxmox-tfa/src/api/webauthn.rs @@ -1,6 +1,6 @@ //! Webauthn configuration and challenge data. -use std::fmt::Display; +use std::fmt; use anyhow::{format_err, Error}; use serde::{Deserialize, Serialize}; @@ -44,9 +44,9 @@ impl From for String { } } -impl Display for OriginUrl { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.0.origin().ascii_serialization()) +impl fmt::Display for OriginUrl { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_str(&self.0.origin().ascii_serialization()) } }