Update build image to Rust 1.51 #8

Merged
cameron merged 3 commits from feature/update-to-1.51 into master 2021-03-26 12:40:26 +00:00
2 changed files with 10 additions and 12 deletions
Showing only changes of commit 31e95dc158 - Show all commits

View File

@@ -144,9 +144,7 @@ pub mod testhelpers {
.user_map
.borrow()
.iter()
.filter(|u| u.username == user && u.password == pass)
.collect::<Vec<&User>>()
.first()
.find(|&u| u.username == user && u.password == pass)
{
Some(u) => {
let copy = (*u).clone();
@@ -160,9 +158,7 @@ pub mod testhelpers {
self.user_map
.borrow()
.iter()
.filter(|u| u.username == user)
.collect::<Vec<&User>>()
.first()
.find(|&u| u.username == user)
.is_some()
}
}

View File

@@ -234,9 +234,12 @@ async fn favorites(claims: Claims) -> impl Responder {
async fn post_add_favorite(claims: Claims, body: web::Json<AddFavoriteRequest>) -> impl Responder {
if let Ok(user_id) = claims.sub.parse::<i32>() {
let path = body.path.clone();
web::block::<_, _, String>(move || Ok(add_favorite(user_id, path)))
.await
.unwrap();
web::block::<_, _, String>(move || {
add_favorite(user_id, path);
Ok(())
})
.await
.unwrap();
debug!("Adding favorite \"{}\" for userid: {}", user_id, body.path);
HttpResponse::Ok()
} else {
@@ -330,9 +333,8 @@ fn main() -> std::io::Result<()> {
DebouncedEvent::Rename(orig, _) | DebouncedEvent::Write(orig) => {
let image_base_path = PathBuf::from(env::var("BASE_PATH").unwrap());
let image_relative = orig.strip_prefix(&image_base_path).unwrap();
if let Ok(old_thumbnail) = env::var("THUMBNAILS")
.map(|base| PathBuf::from(base))
.map(|mut base| {
if let Ok(old_thumbnail) =
env::var("THUMBNAILS").map(PathBuf::from).map(|mut base| {
base.push(image_relative);
base
})