Skip to content

Commit

Permalink
Make Clippy happy
Browse files Browse the repository at this point in the history
  • Loading branch information
jasl committed Oct 9, 2023
1 parent fc5ea2a commit 15ee1f7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/phactory/api/src/proto_generated/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
mod protos_codec_extensions;
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::derive_partial_eq_without_eq, clippy::let_unit_value)]
mod pruntime_rpc;

pub use protos_codec_extensions::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/phactory/src/contracts/pink/http_counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub(super) fn add(contract: AccountId, status_code: u16) {
let counters = counters
.by_contract
.entry(contract)
.or_insert_with(HttpCoutners::default);
.or_default();
counters.latest_activity = now;
counters.requests += 1;
if !success {
Expand Down
11 changes: 4 additions & 7 deletions standalone/prb/src/configurator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,12 @@ pub async fn cli_main(args: ConfigCliArgs) -> Result<()> {
ConfigCommands::GetPoolOperator { pid } => {
let pid = *pid;
let po = po_db.get_po(pid)?;
if po.is_some() {
let po = po.unwrap();
if let Some(po) = po {
let po = serde_json::to_string_pretty::<PoolOperatorForSerialize>(&(&po).into())?;
println!("{po}");
} else {
return Err(anyhow!("Record not found!"));
}
};
}
ConfigCommands::SetPoolOperator {
pid,
Expand Down Expand Up @@ -233,10 +232,8 @@ pub async fn api_handler(db: WrappedDb, po_db: Arc<DB>, command: ConfigCommands)
}
ConfigCommands::GetPoolOperator { pid } => {
let po = po_db.get_po(pid)?;
if po.is_some() {
let po = po.unwrap();
let po = serde_json::to_string_pretty::<PoolOperatorForSerialize>(&(&po).into())?;
Ok(po)
if let Some(po) = po {
Ok(serde_json::to_string_pretty::<PoolOperatorForSerialize>(&(&po).into())?)
} else {
Err(anyhow!("Record not found!"))
}
Expand Down
2 changes: 1 addition & 1 deletion standalone/prb/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ pub fn get_all_raw_pools(db: WrappedDb) -> Result<Vec<VertexProperties>> {
pub fn get_all_workers(db: WrappedDb) -> Result<Vec<Worker>> {
let workers = get_all_pools_with_workers(db)?
.into_iter()
.flat_map(|p| p.workers.unwrap_or(vec![]))
.flat_map(|p| p.workers.unwrap_or_default())
.collect::<Vec<_>>();
Ok(workers)
}
Expand Down

0 comments on commit 15ee1f7

Please sign in to comment.