Skip to content

ci, src: run clippy on nightly, apply fixes #707

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
toolchain: nightly
override: true

- name: setup
Expand Down
4 changes: 2 additions & 2 deletions src/route.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl<'a, State: Clone + Send + Sync + 'static> Route<'a, State> {
let mut p = self.path.clone();

if !p.ends_with('/') && !path.starts_with('/') {
p.push_str("/");
p.push('/');
}

if path != "/" {
Expand Down Expand Up @@ -286,7 +286,7 @@ where
route_params,
} = req;

let rest = crate::request::rest(&route_params).unwrap_or_else(|| "");
let rest = crate::request::rest(&route_params).unwrap_or("");
req.url_mut().set_path(&rest);

self.0
Expand Down
8 changes: 8 additions & 0 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ use crate::{Endpoint, Request, Route};
pub struct Server<State> {
router: Arc<Router<State>>,
state: State,
/// Holds the middleware stack.
///
/// Note(Fishrock123): We do actually want this structure.
/// The outer Arc allows us to clone in .respond() without cloning the array.
/// The Vec allows us to add middleware at runtime.
/// The inner Arc-s allow MiddlewareEndpoint-s to be cloned internally.
/// We don't use a Mutex around the Vec here because adding a middleware during execution should be an error.
#[allow(clippy::rc_buffer)]
middleware: Arc<Vec<Arc<dyn Middleware<State>>>>,
}

Expand Down