aboutsummaryrefslogtreecommitdiffstats
path: root/rust/src/bin
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2022-10-05 16:49:40 -0700
committerBryan Newbold <bnewbold@robocracy.org>2022-10-05 16:49:40 -0700
commit9faf093b50da190a5efee47f3b00bd425a940c40 (patch)
tree396a6fd04188385217b6e3c0cae4f91069f1ec38 /rust/src/bin
parent00c97e7a0ffb43460d544e83d2f6f2856c241cd7 (diff)
downloadfatcat-9faf093b50da190a5efee47f3b00bd425a940c40.tar.gz
fatcat-9faf093b50da190a5efee47f3b00bd425a940c40.zip
rust: clippy cleanups
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