clean up Error

This commit is contained in:
Paul Campbell 2023-07-29 20:22:57 +01:00
parent 7c752b7ba7
commit 9cb02f6790

View file

@ -1,8 +1,8 @@
use std::{fmt::Display, str::Utf8Error, string::FromUtf8Error}; use std::{str::Utf8Error, string::FromUtf8Error};
#[derive(Debug)] #[derive(Debug)]
pub struct Error { pub struct Error {
details: String, pub details: String,
} }
impl Error { impl Error {
pub fn message(details: &str) -> Self { pub fn message(details: &str) -> Self {
@ -11,11 +11,6 @@ impl Error {
} }
} }
} }
impl Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.details.to_string().as_str())
}
}
impl From<Utf8Error> for Error { impl From<Utf8Error> for Error {
fn from(value: Utf8Error) -> Self { fn from(value: Utf8Error) -> Self {
Self { Self {