Skip to content

Commit b0eafba

Browse files
committed
Fix lints
1 parent d8763bb commit b0eafba

File tree

7 files changed

+19
-19
lines changed

7 files changed

+19
-19
lines changed

src/cookies/middleware.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub(crate) struct CookiesMiddleware;
2929

3030
impl CookiesMiddleware {
3131
/// Creates a new `CookiesMiddleware`.
32-
pub fn new() -> Self {
32+
pub(crate) fn new() -> Self {
3333
Self::default()
3434
}
3535
}

src/endpoint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ where
6767
}
6868
}
6969

70-
pub struct MiddlewareEndpoint<E, State> {
70+
pub(crate) struct MiddlewareEndpoint<E, State> {
7171
endpoint: E,
7272
middleware: Vec<Arc<dyn Middleware<State>>>,
7373
}
@@ -96,7 +96,7 @@ where
9696
State: Clone + Send + Sync + 'static,
9797
E: Endpoint<State>,
9898
{
99-
pub fn wrap_with_middleware(ep: E, middleware: &[Arc<dyn Middleware<State>>]) -> Self {
99+
pub(crate) fn wrap_with_middleware(ep: E, middleware: &[Arc<dyn Middleware<State>>]) -> Self {
100100
Self {
101101
endpoint: ep,
102102
middleware: middleware.to_vec(),

src/fs/serve_dir.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use async_std::path::PathBuf as AsyncPathBuf;
66
use std::ffi::OsStr;
77
use std::path::{Path, PathBuf};
88

9-
pub struct ServeDir {
9+
pub(crate) struct ServeDir {
1010
prefix: String,
1111
dir: PathBuf,
1212
}

src/lib.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
#![cfg_attr(feature = "docs", feature(doc_cfg))]
5656
#![forbid(unsafe_code, rust_2018_idioms)]
5757
#![deny(future_incompatible, missing_debug_implementations, nonstandard_style)]
58-
#![warn(missing_docs, missing_doc_code_examples, unreachable_pub)]
58+
#![warn(missing_docs, unreachable_pub)]
5959
#![doc(html_favicon_url = "https://yoshuawuyts.com/assets/http-rs/favicon.ico")]
6060
#![doc(html_logo_url = "https://yoshuawuyts.com/assets/http-rs/logo-rounded.png")]
6161

@@ -69,12 +69,11 @@ mod request;
6969
mod response;
7070
mod response_builder;
7171
mod route;
72+
mod server;
7273

73-
#[cfg(not(feature = "__internal__bench"))]
74-
mod router;
75-
#[cfg(feature = "__internal__bench")]
74+
// Expose the router for benchmarking only.
75+
#[doc(hidden)]
7676
pub mod router;
77-
mod server;
7877

7978
pub mod convert;
8079
pub mod listener;

src/listener/to_listener.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,10 @@ use async_std::io;
4747
/// ```
4848
/// # Other implementations
4949
/// See below for additional provided implementations of ToListener.
50-
5150
pub trait ToListener<State: Clone + Send + Sync + 'static> {
51+
/// What listener are we converting into?
5252
type Listener: Listener<State>;
53+
5354
/// Transform self into a
5455
/// [`Listener`](crate::listener::Listener). Unless self is
5556
/// already bound/connected to the underlying io, converting to a

src/router.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,38 +9,38 @@ use crate::{Request, Response, StatusCode};
99
/// Internally, we have a separate state machine per http method; indexing
1010
/// by the method first allows the table itself to be more efficient.
1111
#[allow(missing_debug_implementations)]
12-
pub struct Router<State> {
12+
pub(crate) struct Router<State> {
1313
method_map: HashMap<http_types::Method, MethodRouter<Box<DynEndpoint<State>>>>,
1414
all_method_router: MethodRouter<Box<DynEndpoint<State>>>,
1515
}
1616

1717
/// The result of routing a URL
1818
#[allow(missing_debug_implementations)]
19-
pub struct Selection<'a, State> {
19+
pub(crate) struct Selection<'a, State> {
2020
pub(crate) endpoint: &'a DynEndpoint<State>,
2121
pub(crate) params: Params,
2222
}
2323

2424
impl<State: Clone + Send + Sync + 'static> Router<State> {
25-
pub fn new() -> Self {
25+
pub(crate) fn new() -> Self {
2626
Router {
2727
method_map: HashMap::default(),
2828
all_method_router: MethodRouter::new(),
2929
}
3030
}
3131

32-
pub fn add(&mut self, path: &str, method: http_types::Method, ep: Box<DynEndpoint<State>>) {
32+
pub(crate) fn add(&mut self, path: &str, method: http_types::Method, ep: Box<DynEndpoint<State>>) {
3333
self.method_map
3434
.entry(method)
3535
.or_insert_with(MethodRouter::new)
3636
.add(path, ep)
3737
}
3838

39-
pub fn add_all(&mut self, path: &str, ep: Box<DynEndpoint<State>>) {
39+
pub(crate) fn add_all(&mut self, path: &str, ep: Box<DynEndpoint<State>>) {
4040
self.all_method_router.add(path, ep)
4141
}
4242

43-
pub fn route(&self, path: &str, method: http_types::Method) -> Selection<'_, State> {
43+
pub(crate) fn route(&self, path: &str, method: http_types::Method) -> Selection<'_, State> {
4444
if let Some(Match { handler, params }) = self
4545
.method_map
4646
.get(&method)

src/security/cors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ pub struct CorsMiddleware {
2727
max_age: HeaderValue,
2828
}
2929

30-
pub const DEFAULT_MAX_AGE: &str = "86400";
31-
pub const DEFAULT_METHODS: &str = "GET, POST, OPTIONS";
32-
pub const WILDCARD: &str = "*";
30+
pub(crate) const DEFAULT_MAX_AGE: &str = "86400";
31+
pub(crate) const DEFAULT_METHODS: &str = "GET, POST, OPTIONS";
32+
pub(crate) const WILDCARD: &str = "*";
3333

3434
impl CorsMiddleware {
3535
/// Creates a new Cors middleware.

0 commit comments

Comments
 (0)