Fix lint
This commit is contained in:
parent
bb5a0bde3a
commit
0311883a16
3 changed files with 9 additions and 9 deletions
|
|
@ -1,5 +1,3 @@
|
|||
use std::default;
|
||||
|
||||
use rand::{Rng as _, distributions::Alphanumeric, thread_rng};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
use std::fmt::Display;
|
||||
|
||||
use aide::OperationOutput;
|
||||
use axum::{
|
||||
Json,
|
||||
|
|
@ -49,16 +51,16 @@ pub struct SerializedError {
|
|||
pub causes: Vec<String>,
|
||||
}
|
||||
|
||||
impl ToString for SerializedError {
|
||||
fn to_string(&self) -> String {
|
||||
let mut result = self.message.clone();
|
||||
impl Display for SerializedError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
if !self.causes.is_empty() {
|
||||
result.push_str("\nCauses:\n");
|
||||
write!(f, "\nCauses:\n")?;
|
||||
for cause in &self.causes {
|
||||
result.push_str(&format!("- {}\n", cause));
|
||||
write!(f, "{}", &format!("- {cause}\n"))?;
|
||||
}
|
||||
}
|
||||
result
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ async fn main() -> ExitCode {
|
|||
match result {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(e) => {
|
||||
eprintln!("{}", e.serialize().to_string());
|
||||
eprintln!("{}", e.serialize());
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue