apply clippy optimizations

This commit is contained in:
yggverse 2024-11-23 18:11:44 +02:00
parent dd1411487e
commit 227c9bb246
6 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ impl Error {
Self::Overwrite(key) => { Self::Overwrite(key) => {
format!("Overwrite attempt for existing record `{key}`") format!("Overwrite attempt for existing record `{key}`")
} }
Self::Unexpected => format!("Unexpected error"), Self::Unexpected => "Unexpected error".to_string(),
} }
} }
} }

View File

@ -8,7 +8,7 @@ impl Error {
pub fn to_string(&self) -> String { pub fn to_string(&self) -> String {
match self { match self {
Self::Database(reason) => { Self::Database(reason) => {
format!("Database error: {}", reason.to_string()) format!("Database error: {}", reason)
} }
Self::Gemini(reason) => { Self::Gemini(reason) => {
format!("Could not init Gemini identity: {}", reason.to_string()) format!("Could not init Gemini identity: {}", reason.to_string())

View File

@ -7,7 +7,7 @@ pub enum Error {
impl Error { impl Error {
pub fn to_string(&self) -> String { pub fn to_string(&self) -> String {
match self { match self {
Self::Database(reason) => format!("Database error: {}", reason.to_string()), Self::Database(reason) => format!("Database error: {}", reason),
Self::Memory(reason) => format!("Memory error: {}", reason.to_string()), Self::Memory(reason) => format!("Memory error: {}", reason.to_string()),
} }
} }

View File

@ -8,11 +8,11 @@ pub enum Error {
impl Error { impl Error {
pub fn to_string(&self) -> String { pub fn to_string(&self) -> String {
match self { match self {
Self::Clear => format!("Could not cleanup memory index"), Self::Clear => "Could not cleanup memory index".to_string(),
Self::Overwrite(key) => { Self::Overwrite(key) => {
format!("Overwrite attempt for existing record `{key}`") format!("Overwrite attempt for existing record `{key}`")
} }
Self::Unexpected => format!("Unexpected error"), Self::Unexpected => "Unexpected error".to_string(),
} }
} }
} }

View File

@ -11,10 +11,10 @@ impl Error {
match self { match self {
Self::Auth(reason) => format!("Could not create auth: {}", reason.to_string()), Self::Auth(reason) => format!("Could not create auth: {}", reason.to_string()),
Self::Certificate(reason) => { Self::Certificate(reason) => {
format!("Could not create certificate: {}", reason.to_string()) format!("Could not create certificate: {}", reason)
} }
Self::Database(reason) => { Self::Database(reason) => {
format!("Database error: {}", reason.to_string()) format!("Database error: {}", reason)
} }
Self::Memory(reason) => format!("Memory error: {}", reason.to_string()), Self::Memory(reason) => format!("Memory error: {}", reason.to_string()),
} }

View File

@ -9,14 +9,14 @@ pub enum Error {
impl Error { impl Error {
pub fn to_string(&self) -> String { pub fn to_string(&self) -> String {
match self { match self {
Self::Clear => format!("Could not cleanup memory index"), Self::Clear => "Could not cleanup memory index".to_string(),
Self::NotFound(key) => { Self::NotFound(key) => {
format!("Record `{key}` not found in memory index") format!("Record `{key}` not found in memory index")
} }
Self::Overwrite(key) => { Self::Overwrite(key) => {
format!("Overwrite attempt for existing record `{key}`") format!("Overwrite attempt for existing record `{key}`")
} }
Self::Unexpected => format!("Unexpected error"), Self::Unexpected => "Unexpected error".to_string(),
} }
} }
} }