Skip to content

Commit

Permalink
convert "or's" to "or_else's"
Browse files Browse the repository at this point in the history
Co-authored-by: Matthew Plant <matty@nova-labs.com>
  • Loading branch information
jeffgrunewald and Matthew Plant committed Apr 10, 2023
1 parent 7d7edfe commit b0c265b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 1 addition & 1 deletion iot_config/src/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ impl KeyType {
pub fn from_i32(v: i32) -> anyhow::Result<Self> {
ProtoKeyType::from_i32(v)
.map(|kt| kt.into())
.ok_or(anyhow!("unsupported key type {}", v))
.ok_or_else(|| anyhow!("unsupported key type {}", v))
}
}

Expand Down
2 changes: 1 addition & 1 deletion iot_config/src/gateway_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ fn h3index_to_region(
) -> anyhow::Result<Region> {
hextree::Cell::from_raw(location)
.map(|cell| region_map.get_region(cell))?
.ok_or(anyhow!("invalid region"))
.ok_or_else(|| anyhow!("invalid region"))
}

#[async_trait::async_trait]
Expand Down
4 changes: 1 addition & 3 deletions iot_config/src/gateway_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,7 @@ impl iot_config::Gateway for GatewayService {
let metadata_info = gateway_info::db::get_info(&self.metadata_pool, address)
.await
.map_err(|_| Status::internal("error fetching gateway info"))?
.ok_or(Status::not_found(format!(
"gateway not found: pubkey = {address:}"
)))?;
.ok_or_else(|| Status::not_found(format!("gateway not found: pubkey = {address:}")))?;

let gateway_info = GatewayInfo::chain_metadata_to_info(metadata_info, &self.region_map);
let mut resp = GatewayInfoResV1 {
Expand Down

0 comments on commit b0c265b

Please sign in to comment.