Skip to content

Commit eeae4ac

Browse files
damienstantonacatangiu
authored andcommitted
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 <[email protected]> Signed-off-by: YUAN LYU <[email protected]>
1 parent a7f035b commit eeae4ac

File tree

6 files changed

+2
-15
lines changed

6 files changed

+2
-15
lines changed

src/common/headers.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ impl Headers {
117117
/// # Examples
118118
///
119119
/// ```
120-
/// extern crate micro_http;
121120
/// use micro_http::Headers;
122121
///
123122
/// let mut request_header = Headers::default();
@@ -217,7 +216,6 @@ impl Headers {
217216
/// # Examples
218217
///
219218
/// ```
220-
/// extern crate micro_http;
221219
/// use micro_http::Headers;
222220
///
223221
/// let request_headers = Headers::try_from(b"Content-Length: 55\r\n\r\n");
@@ -275,7 +273,6 @@ impl MediaType {
275273
/// # Examples
276274
///
277275
/// ```
278-
/// extern crate micro_http;
279276
/// use micro_http::MediaType;
280277
///
281278
/// assert!(MediaType::try_from(b"application/json").is_ok());
@@ -299,7 +296,6 @@ impl MediaType {
299296
/// # Examples
300297
///
301298
/// ```
302-
/// extern crate micro_http;
303299
/// use micro_http::MediaType;
304300
///
305301
/// let media_type = MediaType::ApplicationJson;

src/common/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ impl Display for ServerError {
131131
///
132132
/// ## Examples
133133
/// ```
134-
/// extern crate micro_http;
135134
/// use micro_http::Body;
136135
/// let body = Body::new("This is a test body.".to_string());
137136
/// assert_eq!(body.raw(), b"This is a test body.");
@@ -216,7 +215,6 @@ impl Method {
216215
///
217216
/// # Examples
218217
/// ```
219-
/// extern crate micro_http;
220218
/// use micro_http::Version;
221219
/// let version = Version::try_from(b"HTTP/1.1");
222220
/// assert!(version.is_ok());

src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
//!
4646
//! ## Example for parsing an HTTP Request from a slice
4747
//! ```
48-
//! extern crate micro_http;
4948
//! use micro_http::{Request, Version};
5049
//!
5150
//! let http_request = Request::try_from(b"GET http://localhost/home HTTP/1.0\r\n\r\n").unwrap();
@@ -55,7 +54,6 @@
5554
//!
5655
//! ## Example for creating an HTTP Response
5756
//! ```
58-
//! extern crate micro_http;
5957
//! use micro_http::{Body, MediaType, Response, StatusCode, Version};
6058
//!
6159
//! let mut response = Response::new(Version::Http10, StatusCode::OK);
@@ -82,7 +80,6 @@
8280
//! ## Example for using the server
8381
//!
8482
//! ```
85-
//! extern crate micro_http;
8683
//! use micro_http::{HttpServer, Response, StatusCode};
8784
//!
8885
//! let path_to_socket = "/tmp/example.sock";
@@ -109,9 +106,6 @@
109106
//! }
110107
//! ```
111108
112-
extern crate libc;
113-
extern crate utils;
114-
115109
mod common;
116110
mod connection;
117111
mod request;

src/request.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ impl Request {
178178
/// # Examples
179179
///
180180
/// ```
181-
/// extern crate micro_http;
182181
/// use micro_http::Request;
183182
///
184183
/// let http_request = Request::try_from(b"GET http://localhost/home HTTP/1.0\r\n\r\n").unwrap();

src/server.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,6 @@ impl HttpServer {
397397
///
398398
/// ## Non-blocking server
399399
/// ```
400-
/// extern crate utils;
401-
///
402400
/// use std::os::unix::io::AsRawFd;
403401
///
404402
/// use micro_http::{HttpServer, Response, StatusCode};

src/vmm/src/vmm_config/mmds.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
22
// SPDX-License-Identifier: Apache-2.0
33

4+
use serde::{export::Formatter, Deserialize};
5+
use std::fmt::{Display, Result};
46
use std::net::Ipv4Addr;
57

68
/// Keeps the MMDS configuration.

0 commit comments

Comments
 (0)