diff --git a/app/src/components/user_details_form.rs b/app/src/components/user_details_form.rs index 663e78b..3c428c3 100644 --- a/app/src/components/user_details_form.rs +++ b/app/src/components/user_details_form.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::{fmt::Display, str::FromStr}; use crate::{ components::{ @@ -24,9 +24,13 @@ struct JsFile { contents: Option>, } -impl ToString for JsFile { - fn to_string(&self) -> String { - self.file.as_ref().map(File::name).unwrap_or_default() +impl Display for JsFile { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + self.file.as_ref().map(File::name).unwrap_or_default() + ) } } diff --git a/app/src/infra/modal.rs b/app/src/infra/modal.rs index 0487617..4f99387 100644 --- a/app/src/infra/modal.rs +++ b/app/src/infra/modal.rs @@ -1,3 +1,5 @@ +#![allow(clippy::empty_docs)] + use wasm_bindgen::prelude::*; #[wasm_bindgen] diff --git a/server/src/domain/types.rs b/server/src/domain/types.rs index 2d7d928..a2f2bdf 100644 --- a/server/src/domain/types.rs +++ b/server/src/domain/types.rs @@ -53,9 +53,9 @@ impl<'a> std::convert::TryFrom<&'a str> for Uuid { } } -impl std::string::ToString for Uuid { - fn to_string(&self) -> String { - self.0.clone() +impl std::fmt::Display for Uuid { + fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { + write!(f, "{}", self.0.as_str()) } } @@ -559,14 +559,8 @@ mod tests { #[test] fn test_serialized_i64_len() { assert_eq!(SERIALIZED_I64_LEN, Serialized::from(&0i64).0.len()); - assert_eq!( - SERIALIZED_I64_LEN, - Serialized::from(&i64::max_value()).0.len() - ); - assert_eq!( - SERIALIZED_I64_LEN, - Serialized::from(&i64::min_value()).0.len() - ); + assert_eq!(SERIALIZED_I64_LEN, Serialized::from(&i64::MAX).0.len()); + assert_eq!(SERIALIZED_I64_LEN, Serialized::from(&i64::MIN).0.len()); assert_eq!(SERIALIZED_I64_LEN, Serialized::from(&-1000i64).0.len()); } } diff --git a/server/src/infra/configuration.rs b/server/src/infra/configuration.rs index c6c8129..733c86e 100644 --- a/server/src/infra/configuration.rs +++ b/server/src/infra/configuration.rs @@ -445,10 +445,10 @@ impl ConfigOverrider for LdapsOpts { config.ldaps_options.port = port; } if let Some(path) = self.ldaps_cert_file.as_ref() { - config.ldaps_options.cert_file = path.clone(); + config.ldaps_options.cert_file.clone_from(path); } if let Some(path) = self.ldaps_key_file.as_ref() { - config.ldaps_options.key_file = path.clone(); + config.ldaps_options.key_file.clone_from(path); } } } @@ -470,13 +470,13 @@ impl ConfigOverrider for SmtpOpts { config.smtp_options.reply_to = Some(reply_to.clone()); } if let Some(server) = &self.smtp_server { - config.smtp_options.server = server.clone(); + config.smtp_options.server.clone_from(server); } if let Some(port) = self.smtp_port { config.smtp_options.port = port; } if let Some(user) = &self.smtp_user { - config.smtp_options.user = user.clone(); + config.smtp_options.user.clone_from(user); } if let Some(password) = &self.smtp_password { config.smtp_options.password = SecUtf8::from(password.clone()); diff --git a/server/src/infra/database_string.rs b/server/src/infra/database_string.rs index 6517272..5278e79 100644 --- a/server/src/infra/database_string.rs +++ b/server/src/infra/database_string.rs @@ -29,9 +29,9 @@ impl std::fmt::Debug for DatabaseUrl { } } -impl ToString for DatabaseUrl { - fn to_string(&self) -> String { - self.0.to_string() +impl std::fmt::Display for DatabaseUrl { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_fmt(format_args!("{}", self.0)) } } diff --git a/server/src/infra/ldap_handler.rs b/server/src/infra/ldap_handler.rs index f21d12b..510a33f 100644 --- a/server/src/infra/ldap_handler.rs +++ b/server/src/infra/ldap_handler.rs @@ -31,9 +31,6 @@ use ldap3_proto::proto::{ use std::collections::HashMap; use tracing::{debug, instrument, warn}; -#[derive(Debug, PartialEq, Eq, Clone)] -struct LdapDn(String); - #[derive(Debug)] enum SearchScope { Global,