aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/bin
diff options
context:
space:
mode:
authorbnewbold <bnewbold@archive.org>2022-10-06 01:56:36 +0000
committerbnewbold <bnewbold@archive.org>2022-10-06 01:56:36 +0000
commite5ee112a13cc331a488d395c4da1f80a9dd61930 (patch)
tree396a6fd04188385217b6e3c0cae4f91069f1ec38 /rust/src/bin
parent8bdd5fd92a33cf05424447241033bd529b68af77 (diff)
parent9faf093b50da190a5efee47f3b00bd425a940c40 (diff)
downloadfatcat-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')
-rw-r--r--rust/src/bin/fatcat-auth.rs2
-rw-r--r--rust/src/bin/fatcat-doctor.rs1
-rw-r--r--rust/src/bin/fatcat-export.rs14
-rw-r--r--rust/src/bin/fatcatd.rs2
4 files changed, 9 insertions, 10 deletions
diff --git a/rust/src/bin/fatcat-auth.rs b/rust/src/bin/fatcat-auth.rs
index 0b5c05b0..c351848e 100644
--- a/rust/src/bin/fatcat-auth.rs
+++ b/rust/src/bin/fatcat-auth.rs
@@ -89,7 +89,7 @@ fn main() -> Result<()> {
};
let editor_row = editor.db_create(&db_conn)?;
//println!("{:?}", editor);
- println!("{}", FatcatId::from_uuid(&editor_row.id).to_string());
+ println!("{}", FatcatId::from_uuid(&editor_row.id));
}
("create-token", Some(subm)) => {
let editor_id = FatcatId::from_str(subm.value_of("editor-id").unwrap())?;
diff --git a/rust/src/bin/fatcat-doctor.rs b/rust/src/bin/fatcat-doctor.rs
index 6e869634..7255a22f 100644
--- a/rust/src/bin/fatcat-doctor.rs
+++ b/rust/src/bin/fatcat-doctor.rs
@@ -11,7 +11,6 @@ use fatcat::server::DbConn;
use std::process;
use std::str::FromStr;
-use diesel;
use diesel::prelude::*;
fn backfill_changelog_gap(conn: &DbConn, last_good: i64, max_index: i64) -> Result<()> {
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") {
diff --git a/rust/src/bin/fatcatd.rs b/rust/src/bin/fatcatd.rs
index 52c2bc25..bfa41805 100644
--- a/rust/src/bin/fatcatd.rs
+++ b/rust/src/bin/fatcatd.rs
@@ -48,7 +48,7 @@ fn main() -> Result<()> {
let drain = slog_async::Async::new(drain).build().fuse();
let logger = Logger::root(drain, o!());
let _scope_guard = slog_scope::set_global_logger(logger.clone());
- let _log_guard = slog_stdlog::init().unwrap();
+ slog_stdlog::init().unwrap();
let formatter = DefaultLogFormatter;
// sentry exception handling