diff --git a/src/error.rs b/src/error.rs index 26a85f3..6ba9b2e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,5 @@ -use std::fmt; use std::borrow::Borrow; +use std::fmt; #[derive(Copy, Clone)] pub enum Kind { diff --git a/src/http/handler.rs b/src/http/handler.rs index d8dbc75..b2ff1b2 100644 --- a/src/http/handler.rs +++ b/src/http/handler.rs @@ -1,7 +1,7 @@ use super::Method; +use crate::error::*; use crate::usimp; use crate::websocket; -use crate::error::*; use serde_json; pub struct HttpStream { @@ -132,8 +132,9 @@ fn endpoint_handler( Ok(length) => length, Err(e) => { return error( - Error::new(Kind::HttpRequestParseError, Class::ClientError) - .set_desc(format!("unable to parse field 'Content-Length': {}", &e).to_string()), + Error::new(Kind::HttpRequestParseError, Class::ClientError).set_desc( + format!("unable to parse field 'Content-Length': {}", &e).to_string(), + ), client, ) } @@ -145,9 +146,7 @@ fn endpoint_handler( // TODO decompress let input = match serde_json::from_slice(&buf[..length]) { Ok(val) => val, - Err(e) => { - return error(e.into(), client) - } + Err(e) => return error(e.into(), client), }; let buf = match usimp::endpoint(endpoint, input) {