Skip to content

Commit

Permalink
make code more idiomatic
Browse files Browse the repository at this point in the history
  • Loading branch information
lambda-0x committed Jul 31, 2024
1 parent ccd9a59 commit 0aa5d3e
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions crates/sozo/ops/src/migration/migrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -957,13 +957,12 @@ where
.map(|rw| {
let resource = &rw.resource;
match resource {
ResourceType::Selector(s) => {
if let Some(r) = resource_map.get(&s.to_hex_string()) {
r.clone()
} else {
resource.clone()
}
}
// Replace selector with appropriate resource type if present in
// resource_map
ResourceType::Selector(s) => resource_map
.get(&s.to_hex_string())
.cloned()
.unwrap_or_else(|| rw.resource.clone()),

Check warning on line 965 in crates/sozo/ops/src/migration/migrate.rs

View check run for this annotation

Codecov / codecov/patch

crates/sozo/ops/src/migration/migrate.rs#L962-L965

Added lines #L962 - L965 were not covered by tests
_ => resource.clone(),
}
})
Expand All @@ -984,13 +983,10 @@ where
match resource {

Check warning on line 983 in crates/sozo/ops/src/migration/migrate.rs

View check run for this annotation

Codecov / codecov/patch

crates/sozo/ops/src/migration/migrate.rs#L976-L983

Added lines #L976 - L983 were not covered by tests
// Replace selector with appropriate resource type if present in
// resource_map
ResourceType::Selector(s) => {
if let Some(r) = resource_map.get(&s.to_hex_string()) {
r.clone()
} else {
resource.clone()
}
}
ResourceType::Selector(s) => resource_map
.get(&s.to_hex_string())
.cloned()
.unwrap_or_else(|| rw.resource.clone()),
_ => resource.clone(),

Check warning on line 990 in crates/sozo/ops/src/migration/migrate.rs

View check run for this annotation

Codecov / codecov/patch

crates/sozo/ops/src/migration/migrate.rs#L986-L990

Added lines #L986 - L990 were not covered by tests
}
})
Expand Down

0 comments on commit 0aa5d3e

Please sign in to comment.