diff options
author | bnewbold <bnewbold@archive.org> | 2022-10-06 01:56:36 +0000 |
---|---|---|
committer | bnewbold <bnewbold@archive.org> | 2022-10-06 01:56:36 +0000 |
commit | e5ee112a13cc331a488d395c4da1f80a9dd61930 (patch) | |
tree | 396a6fd04188385217b6e3c0cae4f91069f1ec38 /rust/src/bin/fatcat-export.rs | |
parent | 8bdd5fd92a33cf05424447241033bd529b68af77 (diff) | |
parent | 9faf093b50da190a5efee47f3b00bd425a940c40 (diff) | |
download | fatcat-e5ee112a13cc331a488d395c4da1f80a9dd61930.tar.gz fatcat-e5ee112a13cc331a488d395c4da1f80a9dd61930.zip |
Merge branch 'bnewbold-rust-macaroons-upstream' into 'master'
rust: refactor closer to 'macaroon' crate
See merge request webgroup/fatcat!143
Diffstat (limited to 'rust/src/bin/fatcat-export.rs')
-rw-r--r-- | rust/src/bin/fatcat-export.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/rust/src/bin/fatcat-export.rs b/rust/src/bin/fatcat-export.rs index 7d671b9a..9ac977aa 100644 --- a/rust/src/bin/fatcat-export.rs +++ b/rust/src/bin/fatcat-export.rs @@ -28,7 +28,7 @@ use std::thread; const CHANNEL_BUFFER_LEN: usize = 200; arg_enum! { - #[derive(PartialEq, Debug, Clone, Copy)] + #[derive(PartialEq, Debug, Clone, Copy, Eq)] pub enum ExportEntityType { Creator, Container, @@ -163,7 +163,7 @@ fn parse_line(s: &str) -> Result<IdentRow> { let group_id: Option<FatcatId> = if fields.len() == 4 { match fields[3].as_ref() { "" => None, - val => Some(FatcatId::from_uuid(&Uuid::from_str(&val)?)), + val => Some(FatcatId::from_uuid(&Uuid::from_str(val)?)), } } else if fields.len() == 3 { None @@ -174,11 +174,11 @@ fn parse_line(s: &str) -> Result<IdentRow> { ident_id: FatcatId::from_uuid(&Uuid::from_str(&fields[0])?), rev_id: match fields[1].as_ref() { "" => None, - val => Some(Uuid::from_str(&val)?), + val => Some(Uuid::from_str(val)?), }, redirect_id: match fields[2].as_ref() { "" => None, - val => Some(FatcatId::from_uuid(&Uuid::from_str(&val)?)), + val => Some(FatcatId::from_uuid(&Uuid::from_str(val)?)), }, group_id, }) @@ -331,7 +331,7 @@ pub fn do_export_batch( (Some(_), Some(_), false) => (), _ => { if row.group_id == None || row.group_id != last_group_id { - if batch.len() > 0 { + if !batch.is_empty() { row_sender.send(batch); batch = vec![]; } @@ -345,7 +345,7 @@ pub fn do_export_batch( info!("processed {} lines...", count); } } - if batch.len() > 0 { + if !batch.is_empty() { row_sender.send(batch); } drop(row_sender); @@ -385,7 +385,7 @@ fn main() -> Result<()> { None => std::cmp::min(1, num_cpus::get() / 2) as usize, }; let expand = match m.value_of("expand") { - Some(s) => Some(ExpandFlags::from_str(&s)?), + Some(s) => Some(ExpandFlags::from_str(s)?), None => None, }; let log_level = if m.is_present("quiet") { |