Skip to content

Commit

Permalink
Clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
LDeakin committed Jan 26, 2024
1 parent e414b10 commit cefb65c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 18 deletions.
5 changes: 2 additions & 3 deletions src/array/chunk_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,8 @@ impl TryFrom<ArrayShape> for ChunkGrid {
let regular_chunk_shape = regular_chunk_shape
.into_iter()
.map(|i| {
NonZeroU64::new(i).ok_or(PluginCreateError::from(
"chunk shape elements must be non-zero",
))
NonZeroU64::new(i)
.ok_or_else(|| PluginCreateError::from("chunk shape elements must be non-zero"))
})
.collect::<Result<Vec<_>, _>>()?
.into();
Expand Down
34 changes: 19 additions & 15 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,21 +163,25 @@ impl Metadata {
},
|configuration| {
let value = serde_json::to_value(configuration);
match value {
Ok(value) => serde_json::from_value(value).map_or_else(
|_| {
Err(ConfigurationInvalidError::new(
self.name.clone(),
self.configuration.clone(),
))
},
|configuration| Ok(configuration),
),
Err(_) => Err(ConfigurationInvalidError::new(
self.name.clone(),
self.configuration.clone(),
)),
}
value.map_or_else(
|_| {
Err(ConfigurationInvalidError::new(
self.name.clone(),
self.configuration.clone(),
))
},
|value| {
serde_json::from_value(value).map_or_else(
|_| {
Err(ConfigurationInvalidError::new(
self.name.clone(),
self.configuration.clone(),
))
},
|configuration| Ok(configuration),
)
},
)
},
)
}
Expand Down

0 comments on commit cefb65c

Please sign in to comment.