aboutsummaryrefslogtreecommitdiff
path: root/src/http
diff options
context:
space:
mode:
authoracdenisSK <[email protected]>2018-03-29 12:10:43 +0200
committeracdenisSK <[email protected]>2018-03-29 12:11:23 +0200
commit4c05e828d5191975ef1a5e1ac581b646a69d2c25 (patch)
treefb583f88a1e5d192651b399aca1839f3f58e661e /src/http
parentAdd a connection timeout (diff)
downloadserenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.tar.xz
serenity-4c05e828d5191975ef1a5e1ac581b646a69d2c25.zip
Refactor imports/exports to use nested groups and better formatting
Diffstat (limited to 'src/http')
-rw-r--r--src/http/error.rs10
-rw-r--r--src/http/mod.rs38
-rw-r--r--src/http/ratelimiting.rs12
3 files changed, 41 insertions, 19 deletions
diff --git a/src/http/error.rs b/src/http/error.rs
index 12de978..2a5adeb 100644
--- a/src/http/error.rs
+++ b/src/http/error.rs
@@ -1,6 +1,12 @@
use hyper::client::Response;
-use std::error::Error as StdError;
-use std::fmt::{Display, Formatter, Result as FmtResult};
+use std::{
+ error::Error as StdError,
+ fmt::{
+ Display,
+ Formatter,
+ Result as FmtResult
+ }
+};
#[derive(Debug)]
pub enum Error {
diff --git a/src/http/mod.rs b/src/http/mod.rs
index 30d42e9..621bb01 100644
--- a/src/http/mod.rs
+++ b/src/http/mod.rs
@@ -31,12 +31,22 @@ pub use self::error::Error as HttpError;
pub use hyper::status::{StatusClass, StatusCode};
use constants;
-use hyper::client::{Client as HyperClient, Request, RequestBuilder, Response as HyperResponse};
-use hyper::header::ContentType;
-use hyper::method::Method;
-use hyper::mime::{Mime, SubLevel, TopLevel};
-use hyper::net::HttpsConnector;
-use hyper::{header, Error as HyperError, Result as HyperResult, Url};
+use hyper::{
+ client::{
+ Client as HyperClient,
+ Request,
+ RequestBuilder,
+ Response as HyperResponse
+ },
+ header::ContentType,
+ method::Method,
+ mime::{Mime, SubLevel, TopLevel},
+ net::HttpsConnector,
+ header,
+ Error as HyperError,
+ Result as HyperResult,
+ Url
+};
use hyper_native_tls::NativeTlsClient;
use internal::prelude::*;
use model::prelude::*;
@@ -44,13 +54,15 @@ use multipart::client::Multipart;
use parking_lot::Mutex;
use self::ratelimiting::Route;
use serde_json;
-use std::collections::BTreeMap;
-use std::default::Default;
-use std::fmt::Write as FmtWrite;
-use std::fs::File;
-use std::io::ErrorKind as IoErrorKind;
-use std::path::{Path, PathBuf};
-use std::sync::Arc;
+use std::{
+ collections::BTreeMap,
+ default::Default,
+ fmt::Write as FmtWrite,
+ fs::File,
+ io::ErrorKind as IoErrorKind,
+ path::{Path, PathBuf},
+ sync::Arc
+};
/// An method used for ratelimiting special routes.
///
diff --git a/src/http/ratelimiting.rs b/src/http/ratelimiting.rs
index d46d196..bb59d21 100644
--- a/src/http/ratelimiting.rs
+++ b/src/http/ratelimiting.rs
@@ -46,10 +46,14 @@ use hyper::header::Headers;
use hyper::status::StatusCode;
use internal::prelude::*;
use parking_lot::Mutex;
-use std::collections::HashMap;
-use std::sync::Arc;
-use std::time::Duration;
-use std::{str, thread, i64};
+use std::{
+ collections::HashMap,
+ sync::Arc,
+ time::Duration,
+ str,
+ thread,
+ i64
+};
use super::{HttpError, LightMethod};
lazy_static! {