diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-17 16:36:34 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2019-01-17 16:36:34 -0800 |
commit | 557ff17c9bca18be90f49e9490fd50a362e32d81 (patch) | |
tree | 7abc798988089c5ba463db34ae895524ae07ad4c /rust/src | |
parent | c7aa313b81c15ffcd0451f69c1db67b83763e25a (diff) | |
download | fatcat-557ff17c9bca18be90f49e9490fd50a362e32d81.tar.gz fatcat-557ff17c9bca18be90f49e9490fd50a362e32d81.zip |
rust fmt
Diffstat (limited to 'rust/src')
-rw-r--r-- | rust/src/database_models.rs | 4 | ||||
-rw-r--r-- | rust/src/entity_crud.rs | 18 |
2 files changed, 15 insertions, 7 deletions
diff --git a/rust/src/database_models.rs b/rust/src/database_models.rs index b76b469a..ce804c50 100644 --- a/rust/src/database_models.rs +++ b/rust/src/database_models.rs @@ -4,7 +4,9 @@ use crate::database_schema::*; use crate::errors::*; use crate::identifiers::uuid2fcid; use chrono; -use fatcat_api_spec::models::{ChangelogEntry, Editgroup, EditgroupAnnotation, Editor, EntityEdit, ReleaseRef}; +use fatcat_api_spec::models::{ + ChangelogEntry, Editgroup, EditgroupAnnotation, Editor, EntityEdit, ReleaseRef, +}; use serde_json; use uuid::Uuid; diff --git a/rust/src/entity_crud.rs b/rust/src/entity_crud.rs index 09ce9542..a7186f38 100644 --- a/rust/src/entity_crud.rs +++ b/rust/src/entity_crud.rs @@ -1829,7 +1829,8 @@ impl EntityCrud for ReleaseEntity { refs[index].index = Some(index as i64) } for row in ref_rows { - refs[row.index_val as usize].target_release_id = Some(FatcatId::from_uuid(&row.target_release_ident_id).to_string()); + refs[row.index_val as usize].target_release_id = + Some(FatcatId::from_uuid(&row.target_release_ident_id).to_string()); } refs }), @@ -1960,11 +1961,11 @@ impl EntityCrud for ReleaseEntity { match &model.refs { None => { refs_blob_sha1.push(None); - }, + } Some(ref_list) => { if ref_list.is_empty() { refs_blob_sha1.push(None); - continue + continue; } // Have to strip out target refs and indexes, or hashing won't work well when // these change @@ -1981,7 +1982,10 @@ impl EntityCrud for ReleaseEntity { let refs_json = serde_json::to_value(ref_list)?; let refs_str = refs_json.to_string(); let sha1 = Sha1::from(refs_str).hexdigest(); - let blob = RefsBlobRow { sha1: sha1.clone(), refs_json }; + let blob = RefsBlobRow { + sha1: sha1.clone(), + refs_json, + }; refs_blob_rows.push(blob); refs_blob_sha1.push(Some(sha1)); } @@ -2044,7 +2048,6 @@ impl EntityCrud for ReleaseEntity { let mut release_abstract_rows: Vec<ReleaseRevAbstractNewRow> = vec![]; for (model, rev_id) in models.iter().zip(rev_ids.iter()) { - // We didn't know the release_rev id to insert here, so need to re-iterate over refs match &model.refs { None => (), @@ -2057,7 +2060,10 @@ impl EntityCrud for ReleaseEntity { Ok(ReleaseRefRow { release_rev: *rev_id, // unwrap() checked by is_some() filter - target_release_ident_id: FatcatId::from_str(&r.target_release_id.clone().unwrap())?.to_uuid(), + target_release_ident_id: FatcatId::from_str( + &r.target_release_id.clone().unwrap(), + )? + .to_uuid(), index_val: index as i32, }) }) |