summaryrefslogtreecommitdiffstats
path: root/rust/src/api_wrappers.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:26:57 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-09-22 17:26:57 -0700
commitbfcf13c205e7c0fd38a0fc68194f8ab9550ca0a7 (patch)
tree423eb676a9b7ec70c5d03c2af38493adc053ebd5 /rust/src/api_wrappers.rs
parent7c53a08666d28f2a2f4c9572f63ae09a362b017b (diff)
downloadfatcat-bfcf13c205e7c0fd38a0fc68194f8ab9550ca0a7.tar.gz
fatcat-bfcf13c205e7c0fd38a0fc68194f8ab9550ca0a7.zip
rustfmt, and implement schema tweaks
Diffstat (limited to 'rust/src/api_wrappers.rs')
-rw-r--r--rust/src/api_wrappers.rs36
1 files changed, 20 insertions, 16 deletions
diff --git a/rust/src/api_wrappers.rs b/rust/src/api_wrappers.rs
index 85739ea6..0daff73b 100644
--- a/rust/src/api_wrappers.rs
+++ b/rust/src/api_wrappers.rs
@@ -465,15 +465,19 @@ impl Api for Server {
let id = FatCatId::from_str(&id)?;
self.get_editgroup_handler(id, &conn)
}) {
- Ok(entity) =>
- GetEditgroupResponse::Found(entity),
- Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) =>
- GetEditgroupResponse::NotFound(
- ErrorResponse { message: format!("No such editgroup: {}", id) }),
+ Ok(entity) => GetEditgroupResponse::Found(entity),
+ Err(Error(ErrorKind::Diesel(::diesel::result::Error::NotFound), _)) => {
+ GetEditgroupResponse::NotFound(ErrorResponse {
+ message: format!("No such editgroup: {}", id),
+ })
+ }
Err(e) =>
- // TODO: dig in to error type here
- GetEditgroupResponse::GenericError(
- ErrorResponse { message: e.to_string() }),
+ // TODO: dig in to error type here
+ {
+ GetEditgroupResponse::GenericError(ErrorResponse {
+ message: e.to_string(),
+ })
+ }
};
Box::new(futures::done(Ok(ret)))
}
@@ -484,15 +488,15 @@ impl Api for Server {
_context: &Context,
) -> Box<Future<Item = CreateEditgroupResponse, Error = ApiError> + Send> {
let conn = self.db_pool.get().expect("db_pool error");
- let ret = match conn.transaction(||
- self.create_editgroup_handler(entity, &conn)
- ) {
- Ok(eg) =>
- CreateEditgroupResponse::SuccessfullyCreated(eg),
+ let ret = match conn.transaction(|| self.create_editgroup_handler(entity, &conn)) {
+ Ok(eg) => CreateEditgroupResponse::SuccessfullyCreated(eg),
Err(e) =>
- // TODO: dig in to error type here
- CreateEditgroupResponse::GenericError(
- ErrorResponse { message: e.to_string() }),
+ // TODO: dig in to error type here
+ {
+ CreateEditgroupResponse::GenericError(ErrorResponse {
+ message: e.to_string(),
+ })
+ }
};
Box::new(futures::done(Ok(ret)))
}