From 7226334be052bffab35e96ffc6b8e828946056da Mon Sep 17 00:00:00 2001 From: Waleed Khan Date: Sun, 20 Aug 2023 16:28:53 -0700 Subject: [PATCH] backend: reduce `BackendError` size somewhat 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. --- lib/src/backend.rs | 4 +++- lib/src/git_backend.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/src/backend.rs b/lib/src/backend.rs index f9274eac9b..b052a37c6e 100644 --- a/lib/src/backend.rs +++ b/lib/src/backend.rs @@ -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, }, #[error("Object {hash} of type {object_type} not found: {source}")] ObjectNotFound { diff --git a/lib/src/git_backend.rs b/lib/src/git_backend.rs index d11b78427a..c34653499c 100644 --- a/lib/src/git_backend.rs +++ b/lib/src/git_backend.rs @@ -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)