1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-08-30 16:40:21 +02:00

clippy warnings; fmt

This commit is contained in:
Nikolay Kim
2018-04-28 22:55:47 -07:00
parent a38c3985f6
commit de49796fd1
67 changed files with 988 additions and 1866 deletions

View File

@@ -132,10 +132,7 @@ impl<S: 'static> ResourceHandler<S> {
/// ```
pub fn method(&mut self, method: Method) -> &mut Route<S> {
self.routes.push(Route::default());
self.routes
.last_mut()
.unwrap()
.filter(pred::Method(method))
self.routes.last_mut().unwrap().filter(pred::Method(method))
}
/// Register a new route and add handler object.
@@ -188,13 +185,11 @@ impl<S: 'static> ResourceHandler<S> {
/// This is similar to `App's` middlewares, but
/// middlewares get invoked on resource level.
pub fn middleware<M: Middleware<S>>(&mut self, mw: M) {
Rc::get_mut(&mut self.middlewares)
.unwrap()
.push(Box::new(mw));
Rc::get_mut(&mut self.middlewares).unwrap().push(Box::new(mw));
}
pub(crate) fn handle(
&mut self, mut req: HttpRequest<S>, default: Option<&mut ResourceHandler<S>>
&mut self, mut req: HttpRequest<S>, default: Option<&mut ResourceHandler<S>>,
) -> Reply {
for route in &mut self.routes {
if route.check(&mut req) {