Skip to content

Commit

Permalink
fix: Address issues with Rust nightly caused by rust-lang/rust#79819
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Feb 1, 2021
1 parent b83f462 commit 661c355
Show file tree
Hide file tree
Showing 17 changed files with 64 additions and 64 deletions.
4 changes: 2 additions & 2 deletions src/api/collections/get_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ async fn get_collection_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Collections.Read");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetCollection { id: cid, principal_id: uid }.trace()).await?.map(|collection| collection.clone().into())
}
Expand Down
2 changes: 1 addition & 1 deletion src/api/collections/get_collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn get_collections_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Collections.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down
2 changes: 1 addition & 1 deletion src/api/collections/new_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn new_collection_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Collections.Write");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

let collection = state.store.send(StoreCollection {
principal_id: uid,
Expand Down
4 changes: 2 additions & 2 deletions src/api/collections/remove_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ async fn remove_collection_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Collections.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(RemoveCollection { id: cid, principal_id: uid }.trace()).await??;

Expand Down
4 changes: 2 additions & 2 deletions src/api/collections/store_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ async fn store_collection_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Collections.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(StoreCollection {
principal_id: uid,
Expand Down
18 changes: 9 additions & 9 deletions src/api/ideas/get_idea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ async fn get_idea_v1(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetIdea { collection: uid, id: id }.trace()).await?.map(|idea| idea.clone().into())
}
Expand All @@ -26,8 +26,8 @@ async fn get_idea_v2(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetIdea { collection: uid, id: id }.trace()).await?.map(|idea| idea.clone().into())
}
Expand All @@ -40,8 +40,8 @@ async fn get_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand All @@ -56,9 +56,9 @@ async fn get_collection_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let id = parse_uuid!(info.id, idea ID);
let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down
10 changes: 5 additions & 5 deletions src/api/ideas/get_ideas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async fn get_ideas_v1(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetIdeas { collection: uid, is_completed: None, tag: None }.trace()).await?.map(|ideas| web::Json(ideas.iter().map(|i| i.clone().into()).collect()))
}
Expand All @@ -25,7 +25,7 @@ async fn get_ideas_v2(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetIdeas {
collection: uid,
Expand All @@ -42,7 +42,7 @@ async fn get_ideas_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;
state.store.send(GetRoleAssignment { principal_id: uid, collection_id: uid }).await??;
Expand All @@ -62,8 +62,8 @@ async fn get_collection_ideas_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;
state.store.send(GetRoleAssignment { principal_id: uid, collection_id: cid }.trace()).await??;
Expand Down
10 changes: 5 additions & 5 deletions src/api/ideas/get_random_idea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ async fn get_random_idea_v1(state: web::Data<GlobalState>, token: AuthToken) ->
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetRandomIdea { collection: uid, is_completed: None, tag: None }.trace()).await?.map(|idea| idea.clone().into())
}
Expand All @@ -22,7 +22,7 @@ async fn get_random_idea_v2(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetRandomIdea { collection: uid, is_completed: query.complete, tag: query.tag.clone() }.trace()).await?.map(|idea| idea.clone().into())
}
Expand All @@ -35,7 +35,7 @@ async fn get_random_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;
state.store.send(GetRoleAssignment { principal_id: uid, collection_id: uid }.trace()).await??;
Expand All @@ -51,8 +51,8 @@ async fn get_random_collection_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Read");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(GetRoleAssignment { principal_id: uid, collection_id: cid }.trace()).await??;

Expand Down
10 changes: 5 additions & 5 deletions src/api/ideas/new_idea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async fn new_idea_v1(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand All @@ -36,7 +36,7 @@ async fn new_idea_v2(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand All @@ -59,7 +59,7 @@ async fn new_idea_v3(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let uid = parse_uuid!(token.oid(), auth token oid);
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand All @@ -82,8 +82,8 @@ async fn new_collection_idea_v3(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

if cid == uid {
ensure_user_collection(&state, &token).await?;
Expand Down
18 changes: 9 additions & 9 deletions src/api/ideas/remove_idea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ async fn remove_idea_v1(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Write");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(RemoveIdea { collection: uid, id: id }.trace()).await??;

Expand All @@ -28,8 +28,8 @@ async fn remove_idea_v2(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Write");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(RemoveIdea { collection: uid, id: id }.trace()).await??;

Expand All @@ -44,8 +44,8 @@ async fn remove_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Write");

let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

state.store.send(RemoveIdea { collection: uid, id: id }.trace()).await??;

Expand All @@ -60,9 +60,9 @@ async fn remove_collection_idea_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "Ideas.Write");

let id = parse_uuid!(info.id, idea ID);
let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down
18 changes: 9 additions & 9 deletions src/api/ideas/store_idea.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ async fn store_idea_v1(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down Expand Up @@ -47,8 +47,8 @@ async fn store_idea_v2(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down Expand Up @@ -76,8 +76,8 @@ async fn store_idea_v3(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let id = parse_uuid!(info.id, idea ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down Expand Up @@ -105,9 +105,9 @@ async fn store_collection_idea_v3(
require_scope!(token, "Ideas.Write");

let idea: Idea = new_idea.into_inner().into();
let id = parse_uuid!(info.id, idea ID);
let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let id = parse_uuid!(info.id, "idea ID");
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

ensure_user_collection(&state, &token).await?;

Expand Down
4 changes: 2 additions & 2 deletions src/api/macros.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[macro_export]
macro_rules! parse_uuid {
($from:expr, $($desc:tt)+) => {
($from:expr, $desc:expr) => {
u128::from_str_radix($from.replace("-", "").as_str(), 16)
.or(Err(APIError::new(400, "Bad Request", "The $($desc)+ you provided could not be parsed. Please check it and try again.")))?;
.or(Err(APIError::new(400, "Bad Request", &format!("The {} you provided could not be parsed. Please check it and try again.", $desc))))?
};
}

Expand Down
6 changes: 3 additions & 3 deletions src/api/role_assignments/get_role_assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ async fn get_role_assignment_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "RoleAssignments.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let tuid = parse_uuid!(info.user, user ID);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");
let tuid = parse_uuid!(info.user, "user ID");

if uid != tuid {
let role = state.store.send(GetRoleAssignment { collection_id: cid, principal_id: uid }.trace()).await??;
Expand Down
4 changes: 2 additions & 2 deletions src/api/role_assignments/get_role_assignments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ async fn get_role_assignments_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "RoleAssignments.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");

let role = state.store.send(GetRoleAssignment { collection_id: cid, principal_id: uid }.trace()).await??;
match role.role {
Expand Down
6 changes: 3 additions & 3 deletions src/api/role_assignments/remove_role_assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ async fn remove_role_assignment_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "RoleAssignments.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let tuid = parse_uuid!(info.user, user ID);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");
let tuid = parse_uuid!(info.user, "user ID");

if tuid == uid {
return Err(APIError::new(400, "Bad Request", "You cannot remove yourself from a collection. Please request that another collection owner performs this for you."))
Expand Down
6 changes: 3 additions & 3 deletions src/api/role_assignments/store_role_assignment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ async fn store_role_assignment_v3(
require_role!(token, "Administrator", "User");
require_scope!(token, "RoleAssignments.Write");

let cid = parse_uuid!(info.collection, collection ID);
let uid = parse_uuid!(token.oid(), auth token oid);
let tuid = parse_uuid!(info.user, user ID);
let cid = parse_uuid!(info.collection, "collection ID");
let uid = parse_uuid!(token.oid(), "auth token oid");
let tuid = parse_uuid!(info.user, "user ID");

let original_collection = state.store.send(GetCollection {
id: cid,
Expand Down
2 changes: 1 addition & 1 deletion src/api/users/get_user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ async fn get_user_v3(
) -> Result<UserV3, APIError> {
require_role!(token, "Administrator", "User");

let tuid = parse_uuid!(info.user, user ID);
let tuid = parse_uuid!(info.user, "user ID");

state.store.send(GetUser { email_hash: tuid }.trace()).await?.map(|user| user.clone().into())
}
Expand Down

0 comments on commit 661c355

Please sign in to comment.