Skip to content

Commit

Permalink
feat(crosstarget-utils): replace every manual "Display" instance with…
Browse files Browse the repository at this point in the history
… "derive_more"
  • Loading branch information
jkomyno committed Oct 15, 2024
1 parent 655095f commit c1cc43c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
12 changes: 4 additions & 8 deletions libs/crosstarget-utils/src/common/spawn.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use std::fmt::Display;
use derive_more::Display;

#[derive(Debug)]
pub struct SpawnError;
#[derive(Debug, Display)]
#[display(fmt = "Failed to spawn a future")]

impl Display for SpawnError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Failed to spawn a future")
}
}
pub struct SpawnError;

impl std::error::Error for SpawnError {}
11 changes: 3 additions & 8 deletions libs/crosstarget-utils/src/common/timeout.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
use std::fmt::Display;
use derive_more::Display;

#[derive(Debug)]
#[derive(Debug, Display)]
#[display(fmt = "Operation timed out")]
pub struct TimeoutError;

impl Display for TimeoutError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "Operation timed out")
}
}

impl std::error::Error for TimeoutError {}

0 comments on commit c1cc43c

Please sign in to comment.