Use ok_or_else() instead of ok_or(), to silence clippy warnings.

"cargo clippy" started to complain about these, after running "cargo
update". Not sure why it didn't complain before, but seems reasonable to
fix these. (The "cargo update" is not included in this commit)
This commit is contained in:
Heikki Linnakangas
2022-07-14 20:47:35 +03:00
committed by Heikki Linnakangas
parent 79f5685d00
commit a342957aee
2 changed files with 4 additions and 4 deletions

View File

@@ -122,9 +122,7 @@ where
download_index_parts(conf, storage, sync_ids)
.await
.remove(&tenant_id)
.ok_or(anyhow::anyhow!(
"Missing tenant index parts. This is a bug."
))
.ok_or_else(|| anyhow::anyhow!("Missing tenant index parts. This is a bug."))
}
/// Retrieves index data from the remote storage for a given timeline.

View File

@@ -83,7 +83,9 @@ impl ElectionLeader {
) -> Result<bool> {
let resp = self.client.leader(election_name).await?;
let kv = resp.kv().ok_or(anyhow!("failed to get leader response"))?;
let kv = resp
.kv()
.ok_or_else(|| anyhow!("failed to get leader response"))?;
let leader = kv.value_str()?;
Ok(leader == candidate_name)