error: clippy; gain 128 bytes on Error

Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
Maxime “pep” Buquet 2022-09-24 19:00:07 +02:00
parent 55f0759d70
commit 4fff51e9a1
2 changed files with 8 additions and 6 deletions

View file

@ -25,8 +25,8 @@ pub enum Error {
NickAlreadyAssigned(String),
NonexistantSession(FullJid),
SessionAlreadyExists(FullJid),
XMPPError(TokioXMPPError),
ParserError(ParserError),
Xmpp(Box<TokioXMPPError>),
Parser(Box<ParserError>),
}
impl StdError for Error {}
@ -38,20 +38,20 @@ impl fmt::Display for Error {
Error::NickAlreadyAssigned(err) => write!(f, "Nickname already assigned: {}", err),
Error::NonexistantSession(err) => write!(f, "Session doesn't exist: {}", err),
Error::SessionAlreadyExists(err) => write!(f, "Session already exist: {}", err),
Error::XMPPError(err) => write!(f, "XMPP error: {}", err),
Error::ParserError(err) => write!(f, "Parser error: {}", err),
Error::Xmpp(err) => write!(f, "XMPP error: {}", err),
Error::Parser(err) => write!(f, "Parser error: {}", err),
}
}
}
impl From<TokioXMPPError> for Error {
fn from(err: TokioXMPPError) -> Error {
Error::XMPPError(err)
Error::Xmpp(Box::new(err))
}
}
impl From<ParserError> for Error {
fn from(err: ParserError) -> Error {
Error::ParserError(err)
Error::Parser(Box::new(err))
}
}

View file

@ -14,6 +14,8 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
#![feature(let_chains)]
// Maybe change that someday?
#![allow(clippy::result_large_err)]
mod component;
mod error;