From 9ca1bdfdba5de8191ad598ef0cc288eff4d50975 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Fri, 14 Dec 2018 17:35:58 +0800 Subject: new rustfmt (1.31) --- rust/src/bin/fatcat-export.rs | 38 ++++++++++++++++++++++++-------------- rust/src/bin/fatcatd.rs | 3 ++- 2 files changed, 26 insertions(+), 15 deletions(-) (limited to 'rust/src/bin') diff --git a/rust/src/bin/fatcat-export.rs b/rust/src/bin/fatcat-export.rs index 9dd5138e..dd3f4da4 100644 --- a/rust/src/bin/fatcat-export.rs +++ b/rust/src/bin/fatcat-export.rs @@ -40,7 +40,7 @@ use std::io::{BufReader, BufWriter}; const CHANNEL_BUFFER_LEN: usize = 200; -arg_enum!{ +arg_enum! { #[derive(PartialEq, Debug, Clone, Copy)] pub enum ExportEntityType { Creator, @@ -70,16 +70,26 @@ pub fn database_worker_pool() -> Result { macro_rules! generic_loop_work { ($fn_name:ident, $entity_model:ident) => { - fn $fn_name(row_receiver: channel::Receiver, output_sender: channel::Sender, db_conn: &DbConn, expand: Option) { + fn $fn_name( + row_receiver: channel::Receiver, + output_sender: channel::Sender, + db_conn: &DbConn, + expand: Option, + ) { let result: Result<()> = (|| { for row in row_receiver { - let mut entity = $entity_model::db_get_rev(db_conn, row.rev_id.expect("valid, non-deleted row"), HideFlags::none()) - .chain_err(|| "reading entity from database")?; + let mut entity = $entity_model::db_get_rev( + db_conn, + row.rev_id.expect("valid, non-deleted row"), + HideFlags::none(), + ) + .chain_err(|| "reading entity from database")?; //let mut entity = ReleaseEntity::db_get_rev(db_conn, row.rev_id.expect("valid, non-deleted row"))?; entity.state = Some("active".to_string()); // XXX entity.ident = Some(row.ident_id.to_string()); if let Some(expand) = expand { - entity.db_expand(db_conn, expand) + entity + .db_expand(db_conn, expand) .chain_err(|| "expanding sub-entities from database")?; } output_sender.send(serde_json::to_string(&entity)?); @@ -91,7 +101,7 @@ macro_rules! generic_loop_work { } result.unwrap() } - } + }; } generic_loop_work!(loop_work_container, ContainerEntity); @@ -137,14 +147,14 @@ fn parse_line(s: &str) -> Result { #[test] fn test_parse_line() { - assert!( - parse_line("00000000-0000-0000-3333-000000000001\t00000000-0000-0000-3333-fff000000001\t") - .is_ok() - ); - assert!( - parse_line("00000-0000-0000-3333-000000000001\t00000000-0000-0000-3333-fff000000001\t") - .is_err() - ); + assert!(parse_line( + "00000000-0000-0000-3333-000000000001\t00000000-0000-0000-3333-fff000000001\t" + ) + .is_ok()); + assert!(parse_line( + "00000-0000-0000-3333-000000000001\t00000000-0000-0000-3333-fff000000001\t" + ) + .is_err()); assert!( parse_line("00000-0000-0000-3333-000000000001\t00000000-0000-0000-3333-fff000000001") .is_err() diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs index b40ac3c4..57b6a3da 100644 --- a/rust/src/bin/fatcatd.rs +++ b/rust/src/bin/fatcatd.rs @@ -32,7 +32,8 @@ fn main() { Arg::with_name("https") .long("https") .help("Whether to use HTTPS or not"), - ).get_matches(); + ) + .get_matches(); let decorator = slog_term::TermDecorator::new().build(); let drain = slog_term::CompactFormat::new(decorator).build().fuse(); -- cgit v1.2.3