Clear all clippy warnings

Additionally, HttpServer::new_from_fd has been marked as unsafe,
since the correctness of the unsafe call within the function
relies on the caller upholding an invariant

Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
This commit is contained in:
Patrick Roy
2022-11-15 17:15:41 +00:00
committed by Alexandra Iordache
parent d2caafab0e
commit 43d5a1d4b0
8 changed files with 47 additions and 30 deletions

View File

@@ -78,7 +78,7 @@ impl Header {
/// invalidate our request as we don't support the full set of HTTP/1.1 specification.
/// Such header entries are "Transfer-Encoding: identity; q=0", which means a compression
/// algorithm is applied to the body of the request, or "Expect: 103-checkpoint".
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub struct Headers {
/// The `Content-Length` header field tells us how many bytes we need to receive
/// from the source after the headers.
@@ -310,7 +310,7 @@ impl Headers {
}
/// Wrapper over supported AcceptEncoding.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct Encoding {}
impl Encoding {
@@ -367,7 +367,7 @@ impl Encoding {
}
/// Wrapper over supported Media Types.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum MediaType {
/// Media Type: "text/plain".
PlainText,
@@ -450,8 +450,8 @@ mod tests {
fn test_default() {
let headers = Headers::default();
assert_eq!(headers.content_length(), 0);
assert_eq!(headers.chunked(), false);
assert_eq!(headers.expect(), false);
assert!(!headers.chunked());
assert!(!headers.expect());
assert_eq!(headers.accept(), MediaType::PlainText);
assert_eq!(headers.custom_entries(), &HashMap::default());
}

View File

@@ -15,7 +15,7 @@ pub mod ascii {
}
///Errors associated with a header that is invalid.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum HttpHeaderError {
/// The header is misformatted.
InvalidFormat(String),
@@ -64,7 +64,7 @@ impl Display for HttpHeaderError {
}
/// Errors associated with parsing the HTTP Request from a u8 slice.
#[derive(Debug, PartialEq)]
#[derive(Debug, PartialEq, Eq)]
pub enum RequestError {
/// No request was pending while the request body was being parsed.
BodyWithoutPendingRequest,
@@ -195,7 +195,7 @@ impl Display for ServerError {
/// assert_eq!(body.raw(), b"This is a test body.");
/// assert_eq!(body.len(), 20);
/// ```
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct Body {
/// Body of the HTTP message as bytes.
pub body: Vec<u8>,
@@ -281,7 +281,7 @@ impl Method {
/// let version = Version::try_from(b"http/1.1");
/// assert!(version.is_err());
/// ```
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Version {
/// HTTP/1.0
Http10,