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 rand::{Rng as _, distributions::Alphanumeric, thread_rng};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::fmt::Display;
|
||||||
|
|
||||||
use aide::OperationOutput;
|
use aide::OperationOutput;
|
||||||
use axum::{
|
use axum::{
|
||||||
Json,
|
Json,
|
||||||
|
|
@ -49,16 +51,16 @@ pub struct SerializedError {
|
||||||
pub causes: Vec<String>,
|
pub causes: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for SerializedError {
|
impl Display for SerializedError {
|
||||||
fn to_string(&self) -> String {
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||||
let mut result = self.message.clone();
|
|
||||||
if !self.causes.is_empty() {
|
if !self.causes.is_empty() {
|
||||||
result.push_str("\nCauses:\n");
|
write!(f, "\nCauses:\n")?;
|
||||||
for cause in &self.causes {
|
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 {
|
match result {
|
||||||
Ok(()) => ExitCode::SUCCESS,
|
Ok(()) => ExitCode::SUCCESS,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
eprintln!("{}", e.serialize().to_string());
|
eprintln!("{}", e.serialize());
|
||||||
ExitCode::FAILURE
|
ExitCode::FAILURE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue