Skip to content

Commit

Permalink
Clippy-suggested improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
partim committed Jul 25, 2024
1 parent b8ea187 commit ce41f73
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 34 deletions.
2 changes: 1 addition & 1 deletion src/cli/options/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ impl FromStr for KeyValuePair {
fn from_str(src: &str) -> Result<Self, Self::Err> {
match src.split_once(src) {
Some((key, value)) => Ok(Self(key.into(), value.into())),
None => return Err("expecting \"key=value\"")
None => Err("expecting \"key=value\"")
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions src/cli/options/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,19 +162,19 @@ impl Command {
Self::Info(cmd) => cmd.run(client).await.into(),
Self::List(cmd) => cmd.run(client).await.into(),
Self::Show(cmd) => cmd.run(client).await.into(),
Self::History(cmd) => cmd.run(client).await.into(),
Self::History(cmd) => cmd.run(client).await,
Self::Add(cmd) => cmd.run(client).await.into(),
Self::Delete(cmd) => cmd.run(client).await.into(),
Self::Issues(cmd) => cmd.run(client).await.into(),
Self::Children(cmd) => cmd.run(client).await.into(),
Self::Parents(cmd) => cmd.run(client).await.into(),
Self::Keyroll(cmd) => cmd.run(client).await.into(),
Self::Repo(cmd) => cmd.run(client).await.into(),
Self::Roas(cmd) => cmd.run(client).await.into(),
Self::Bgpsec(cmd) => cmd.run(client).await.into(),
Self::Aspas(cmd) => cmd.run(client).await.into(),
Self::Pubserver(cmd) => cmd.run(client).await.into(),
Self::Bulk(cmd) => cmd.run(client).await.into(),
Self::Issues(cmd) => cmd.run(client).await,
Self::Children(cmd) => cmd.run(client).await,
Self::Parents(cmd) => cmd.run(client).await,
Self::Keyroll(cmd) => cmd.run(client).await,
Self::Repo(cmd) => cmd.run(client).await,
Self::Roas(cmd) => cmd.run(client).await,
Self::Bgpsec(cmd) => cmd.run(client).await,
Self::Aspas(cmd) => cmd.run(client).await,
Self::Pubserver(cmd) => cmd.run(client).await,
Self::Bulk(cmd) => cmd.run(client).await,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cli/options/pubserver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Command {
match self {
Self::Publishers(cmd) => cmd.run(client).await,
Self::Delete(cmd) => cmd.run(client).await.into(),
Self::Server(cmd) => cmd.run(client).await.into(),
Self::Server(cmd) => cmd.run(client).await,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cli/report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ pub trait ReportContent {

impl<T: Serialize + fmt::Display> ReportContent for T {
fn write(
&self, format: ReportFormat, mut target: &mut dyn io::Write
&self, format: ReportFormat, target: &mut dyn io::Write
) -> Result<(), io::Error> {
match format {
ReportFormat::None => { Ok(()) }
ReportFormat::Json => {
// The &mut here seems to be necessary to avoid a move into
// the function.
serde_json::to_writer_pretty(&mut target, self)?;
serde_json::to_writer_pretty(&mut *target, self)?;
target.write_all(b"\n")?;
Ok(())
}
Expand Down
9 changes: 0 additions & 9 deletions src/cli/ta/options/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,15 +360,6 @@ impl ChildrenAdd {
}
}

#[derive(Clone, Copy, Default, Debug)]
struct AcrMsg;

impl fmt::Display for AcrMsg {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.write_str("child info")
}
}


//------------ ChildrenResponse ----------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion src/commons/util/cmslogger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ impl CmsLogger {
fn save(&self, content: &[u8], ext: &str) -> Result<(), KrillIoError> {
if let Some(path) = self.path.as_ref() {
let mut path = path.clone();
path.push(&format!("{}.{}", self.now, ext));
path.push(format!("{}.{}", self.now, ext));

file::save(content, &path)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/pubd/repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ impl RsyncdStore {
})?;

let mut new_dir = self.rsync_dir.clone();
new_dir.push(&format!("tmp-{}", serial));
new_dir.push(format!("tmp-{}", serial));
fs::create_dir_all(&new_dir).map_err(|e| {
KrillIoError::new(
format!(
Expand Down
4 changes: 2 additions & 2 deletions tests/functional_aspa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ impl common::KrillServer {
ca,
customer(customer_str),
AspaProvidersUpdate::new(
add.into_iter().map(|s| provider(s)).collect(),
remove.into_iter().map(|s| provider(s)).collect(),
add.into_iter().map(provider).collect(),
remove.into_iter().map(provider).collect(),
)
).await {
Ok(_) => true,
Expand Down
2 changes: 0 additions & 2 deletions tests/functional_ca_import.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//! Test importing a CA.
use krill::commons::api;

mod common;


Expand Down
2 changes: 1 addition & 1 deletion tests/migrate_repository.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async fn migrate_repository() {
server.client().roas_update(
&ca1,
api::RoaConfigurationUpdates::new(
vec![ca1_roa.clone().into()], vec![]
vec![ca1_roa.into()], vec![]
)
).await.unwrap();

Expand Down
2 changes: 1 addition & 1 deletion tests/remote_parent_and_repo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async fn remote_parent_and_repo() {
server2.client().roas_update(
&ca1,
RoaConfigurationUpdates::new(
vec![ca1_roa.clone().into()], vec![]
vec![ca1_roa.into()], vec![]
)
).await.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions tests/suspend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl common::KrillServer {
let rcn0 = common::rcn(0);
let child_handle = child.convert();

let mut files = self.expected_objects(&ca);
let mut files = self.expected_objects(ca);
files.push_mft_and_crl(&rcn0).await;
files.push_cer(child, &rcn0).await;
assert!(files.wait_for_published().await);
Expand All @@ -92,7 +92,7 @@ impl common::KrillServer {
let rcn0 = common::rcn(0);
let child_handle = child.convert();

let mut files = self.expected_objects(&ca);
let mut files = self.expected_objects(ca);
files.push_mft_and_crl(&rcn0).await;
assert!(files.wait_for_published().await);

Expand Down

0 comments on commit ce41f73

Please sign in to comment.