From 2699ddc5f8125465759c968bb7f33d95a8a2f0bc Mon Sep 17 00:00:00 2001 From: Lorenz Stechauner Date: Thu, 20 May 2021 20:00:54 +0200 Subject: [PATCH] Ran cargo fmt --- src/error.rs | 2 +- src/http/handler.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) 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) {