From bb66b3a5665f548d7232da7a4658c4b29492bd62 Mon Sep 17 00:00:00 2001 From: Antoine Gersant Date: Sun, 23 Oct 2016 11:47:57 -0700 Subject: [PATCH] Removed unneeded mutability --- src/api.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/api.rs b/src/api.rs index 987942b..2ecbc2d 100644 --- a/src/api.rs +++ b/src/api.rs @@ -1,5 +1,4 @@ use core::str::Utf8Error; -use core::ops::DerefMut; use std::fs; use std::io; use std::path::PathBuf; @@ -59,22 +58,22 @@ pub fn get_api_handler(collection: Arc>) -> Mount { { let collection = collection.clone(); auth_api_mount.mount("/browse/", move |request: &mut Request| { - let mut acquired_collection = collection.deref().lock().unwrap(); - self::browse(request, acquired_collection.deref_mut()) + let acquired_collection = collection.deref().lock().unwrap(); + self::browse(request, acquired_collection.deref()) }); } { let collection = collection.clone(); auth_api_mount.mount("/flatten/", move |request: &mut Request| { - let mut acquired_collection = collection.deref().lock().unwrap(); - self::flatten(request, acquired_collection.deref_mut()) + let acquired_collection = collection.deref().lock().unwrap(); + self::flatten(request, acquired_collection.deref()) }); } { let collection = collection.clone(); auth_api_mount.mount("/serve/", move |request: &mut Request| { - let mut acquired_collection = collection.deref().lock().unwrap(); - self::serve(request, acquired_collection.deref_mut()) + let acquired_collection = collection.deref().lock().unwrap(); + self::serve(request, acquired_collection.deref()) }); } @@ -125,7 +124,7 @@ fn auth(request: &mut Request, collection: &Collection) -> IronResult } } -fn browse(request: &mut Request, collection: &mut Collection) -> IronResult { +fn browse(request: &mut Request, collection: &Collection) -> IronResult { let path = path_from_request(request); let path = match path { Err(e) => return Err(IronError::new(e, status::BadRequest)), @@ -142,7 +141,7 @@ fn browse(request: &mut Request, collection: &mut Collection) -> IronResult IronResult { +fn flatten(request: &mut Request, collection: &Collection) -> IronResult { let path = path_from_request(request); let path = match path { Err(e) => return Err(IronError::new(e, status::BadRequest)), @@ -159,7 +158,7 @@ fn flatten(request: &mut Request, collection: &mut Collection) -> IronResult IronResult { +fn serve(request: &mut Request, collection: &Collection) -> IronResult { let virtual_path = path_from_request(request); let virtual_path = match virtual_path { Err(e) => return Err(IronError::new(e, status::BadRequest)),