Run cargo fmt

The CI requirements for formatting have changed over the past 3 years

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

View File

@@ -131,8 +131,12 @@ impl Headers {
/// use micro_http::Headers;
///
/// let mut request_header = Headers::default();
/// assert!(request_header.parse_header_line(b"Content-Length: 24").is_ok());
/// assert!(request_header.parse_header_line(b"Content-Length: 24: 2").is_err());
/// assert!(request_header
/// .parse_header_line(b"Content-Length: 24")
/// .is_ok());
/// assert!(request_header
/// .parse_header_line(b"Content-Length: 24: 2")
/// .is_err());
/// ```
pub fn parse_header_line(&mut self, header_line: &[u8]) -> Result<(), RequestError> {
// Headers must be ASCII, so also UTF-8 valid.

View File

@@ -63,9 +63,7 @@ impl<T: Send> HttpRoutes<T> {
///
/// ```
/// extern crate micro_http;
/// use micro_http::{
/// EndpointHandler, HttpRoutes, Method, StatusCode, Request, Response, Version
/// };
/// use micro_http::{EndpointHandler, HttpRoutes, Method, Request, Response, StatusCode, Version};
///
/// struct HandlerArg(bool);
/// struct MockHandler {}
@@ -77,7 +75,9 @@ impl<T: Send> HttpRoutes<T> {
///
/// let mut router = HttpRoutes::new("Mock_Server".to_string(), "/api/v1".to_string());
/// let handler = MockHandler {};
/// router.add_route(Method::Get, "/func1".to_string(), Box::new(handler)).unwrap();
/// router
/// .add_route(Method::Get, "/func1".to_string(), Box::new(handler))
/// .unwrap();
///
/// let request_bytes = b"GET http://localhost/api/v1/func1 HTTP/1.1\r\n\r\n";
/// let request = Request::try_from(request_bytes, None).unwrap();

View File

@@ -492,12 +492,13 @@ impl HttpServer {
/// server.start_server().unwrap();
///
/// // Add our server to the `epoll` manager.
/// epoll.ctl(
/// epoll::ControlOperation::Add,
/// server.epoll().as_raw_fd(),
/// epoll::EpollEvent::new(epoll::EventSet::IN, 1234u64),
/// )
/// .unwrap();
/// epoll
/// .ctl(
/// epoll::ControlOperation::Add,
/// server.epoll().as_raw_fd(),
/// epoll::EpollEvent::new(epoll::EventSet::IN, 1234u64),
/// )
/// .unwrap();
///
/// // Connect a client to the server so it doesn't block in our example.
/// let mut socket = std::os::unix::net::UnixStream::connect(path_to_socket).unwrap();