mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Optimization: Box variants in Error to reduce size and remove unused variants in BinstallError
(#530)
* Box `HttpError` in `binsalk_downloader::remote::Error::Http` as `HttpError` contains `Url` which are too big. * Box `HttpError` in `BinstallError::Http` same as the previous commit. * Box `TinyTemplateError` in `BinstallError::Template` since `TinyTemplateError` is 56 bytes large where most of the other variants are below 40 bytes large. * Rm unsed variant `BinstallError::VersionUnavailable` * Box `CratesIoApiError` in `BinstallError::CratesIoApi` It is 32 bytes large while other variants are below 40 bytes large. * Improve err msg for `BinstallError::CrateContext` * Rm unused variant `BinstallError::VersionReq` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
933c6425ef
commit
c34a2850b3
3 changed files with 15 additions and 37 deletions
|
@ -29,7 +29,7 @@ pub enum Error {
|
|||
Reqwest(#[from] reqwest::Error),
|
||||
|
||||
#[error(transparent)]
|
||||
Http(HttpError),
|
||||
Http(Box<HttpError>),
|
||||
}
|
||||
|
||||
#[derive(Debug, ThisError)]
|
||||
|
@ -138,7 +138,7 @@ impl Client {
|
|||
Ok(response)
|
||||
}
|
||||
})
|
||||
.map_err(|err| Error::Http(HttpError { method, url, err }))
|
||||
.map_err(|err| Error::Http(Box::new(HttpError { method, url, err })))
|
||||
}
|
||||
|
||||
/// Check if remote exists using `method`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue