web: Appease clippy
This commit is contained in:
parent
4ed2b98087
commit
7db1817011
24
src/web.rs
24
src/web.rs
|
@ -39,24 +39,24 @@ struct RequestDevicePayload {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Error {
|
pub enum Error {
|
||||||
IoError(std::io::Error),
|
Io(std::io::Error),
|
||||||
WsError(tokio_websockets::Error),
|
Websocket(tokio_websockets::Error),
|
||||||
JsonError(serde_json::Error),
|
Json(serde_json::Error),
|
||||||
NoData,
|
NoData,
|
||||||
InvalidUri(http::uri::InvalidUri),
|
InvalidUri(http::uri::InvalidUri),
|
||||||
HttpError(reqwest::Error),
|
Http(reqwest::Error),
|
||||||
UnexpectedStatus(reqwest::StatusCode),
|
UnexpectedStatus(reqwest::StatusCode),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl fmt::Display for Error {
|
impl fmt::Display for Error {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
Self::IoError(err) => err.fmt(f),
|
Self::Io(err) => err.fmt(f),
|
||||||
Self::WsError(err) => err.fmt(f),
|
Self::Websocket(err) => err.fmt(f),
|
||||||
Self::JsonError(err) => err.fmt(f),
|
Self::Json(err) => err.fmt(f),
|
||||||
Self::NoData => write!(f, "No data received from web server"),
|
Self::NoData => write!(f, "No data received from web server"),
|
||||||
Self::InvalidUri(err) => err.fmt(f),
|
Self::InvalidUri(err) => err.fmt(f),
|
||||||
Self::HttpError(err) => err.fmt(f),
|
Self::Http(err) => err.fmt(f),
|
||||||
Self::UnexpectedStatus(code) => write!(f, "Unexpected response: {}", code),
|
Self::UnexpectedStatus(code) => write!(f, "Unexpected response: {}", code),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,19 +64,19 @@ impl fmt::Display for Error {
|
||||||
|
|
||||||
impl From<std::io::Error> for Error {
|
impl From<std::io::Error> for Error {
|
||||||
fn from(value: std::io::Error) -> Self {
|
fn from(value: std::io::Error) -> Self {
|
||||||
Error::IoError(value)
|
Error::Io(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<tokio_websockets::Error> for Error {
|
impl From<tokio_websockets::Error> for Error {
|
||||||
fn from(value: tokio_websockets::Error) -> Self {
|
fn from(value: tokio_websockets::Error) -> Self {
|
||||||
Self::WsError(value)
|
Self::Websocket(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<serde_json::Error> for Error {
|
impl From<serde_json::Error> for Error {
|
||||||
fn from(value: serde_json::Error) -> Self {
|
fn from(value: serde_json::Error) -> Self {
|
||||||
Self::JsonError(value)
|
Self::Json(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ impl From<http::uri::InvalidUri> for Error {
|
||||||
|
|
||||||
impl From<reqwest::Error> for Error {
|
impl From<reqwest::Error> for Error {
|
||||||
fn from(value: reqwest::Error) -> Self {
|
fn from(value: reqwest::Error) -> Self {
|
||||||
Self::HttpError(value)
|
Self::Http(value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue