Skip to content

Commit

Permalink
backend: reduce BackendError size somewhat
Browse files Browse the repository at this point in the history
One of the error types that I later created embedded `BackendError`, but `clippy` complained that the size of the type was too large. This helps address that.
  • Loading branch information
arxanas committed Aug 23, 2023
1 parent 30c2a21 commit 7226334
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ pub enum BackendError {
InvalidUtf8 {
object_type: String,
hash: String,
source: std::string::FromUtf8Error,
// Box to reduce size for other error types that include this one:
// https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err
source: Box<std::string::FromUtf8Error>,
},
#[error("Object {hash} of type {object_type} not found: {source}")]
ObjectNotFound {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/git_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ impl Backend for GitBackend {
BackendError::InvalidUtf8 {
object_type: id.object_type(),
hash: id.hex(),
source: err,
source: Box::new(err),
}
})?;
Ok(target)
Expand Down

0 comments on commit 7226334

Please sign in to comment.