Remove all extern crate...

In Rust 2018 edition, it is considered unidiomatic to use "extern crate"
sunthax. The proper way to do it is to replace extern crate with "use"
declarations.

- Also impl clippy suggestions for fn main removal in doctests
- Fix unneeded box allocations and clones

Signed-off-by: Damien Stanton <damien.stanton@gmail.com>
Signed-off-by: YUAN LYU <lyuyuan92@gmail.com>
This commit is contained in:
Damien Stanton
2020-07-28 11:55:14 -04:00
committed by Adrian Catangiu
parent a7f035b8c5
commit eeae4ac11d
6 changed files with 2 additions and 15 deletions

View File

@@ -117,7 +117,6 @@ impl Headers {
/// # Examples
///
/// ```
/// extern crate micro_http;
/// use micro_http::Headers;
///
/// let mut request_header = Headers::default();
@@ -217,7 +216,6 @@ impl Headers {
/// # Examples
///
/// ```
/// extern crate micro_http;
/// use micro_http::Headers;
///
/// let request_headers = Headers::try_from(b"Content-Length: 55\r\n\r\n");
@@ -275,7 +273,6 @@ impl MediaType {
/// # Examples
///
/// ```
/// extern crate micro_http;
/// use micro_http::MediaType;
///
/// assert!(MediaType::try_from(b"application/json").is_ok());
@@ -299,7 +296,6 @@ impl MediaType {
/// # Examples
///
/// ```
/// extern crate micro_http;
/// use micro_http::MediaType;
///
/// let media_type = MediaType::ApplicationJson;

View File

@@ -131,7 +131,6 @@ impl Display for ServerError {
///
/// ## Examples
/// ```
/// extern crate micro_http;
/// use micro_http::Body;
/// let body = Body::new("This is a test body.".to_string());
/// assert_eq!(body.raw(), b"This is a test body.");
@@ -216,7 +215,6 @@ impl Method {
///
/// # Examples
/// ```
/// extern crate micro_http;
/// use micro_http::Version;
/// let version = Version::try_from(b"HTTP/1.1");
/// assert!(version.is_ok());