Skip to content

Commit

Permalink
Reduce error size
Browse files Browse the repository at this point in the history
  • Loading branch information
Jake-Shadle committed Sep 26, 2023
1 parent f8e88a1 commit 82e5a4d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Error {
Json(#[from] serde_json::Error),
/// Failed to deserialize TOML
#[error(transparent)]
Toml(#[from] toml::de::Error),
Toml(#[from] Box<toml::de::Error>),
/// An index entry did not contain any versions
#[error("index entry contained no versions for the crate")]
NoCrateVersions,
Expand Down
11 changes: 3 additions & 8 deletions src/index/git_remote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ impl RemoteGitIndex {
} else {
let (repo, out) = gix::prepare_clone_bare(index.url.as_str(), &index.cache.path)
.map_err(Box::new)?
.with_remote_name("origin")?
.with_remote_name("origin")
.map_err(Box::new)?
.configure_remote(|remote| {
Ok(remote.with_refspecs(["+HEAD:refs/remotes/origin/HEAD"], DIR)?)
})
Expand Down Expand Up @@ -405,12 +406,6 @@ pub enum GitError {
#[error(transparent)]
Open(#[from] Box<gix::open::Error>),
#[error(transparent)]
Peel(#[from] gix::reference::peel::Error),
#[error(transparent)]
Head(#[from] gix::reference::head_commit::Error),
#[error(transparent)]
HeadUpdate(#[from] gix::reference::edit::Error),
#[error(transparent)]
Commit(#[from] gix::object::commit::Error),
#[error(transparent)]
InvalidObject(#[from] gix::object::try_into::Error),
Expand All @@ -423,7 +418,7 @@ pub enum GitError {
#[error(transparent)]
Lock(#[from] gix::lock::acquire::Error),
#[error(transparent)]
RemoteName(#[from] gix::remote::name::Error),
RemoteName(#[from] Box<gix::remote::name::Error>),
#[error(transparent)]
Config(#[from] Box<gix::config::Error>),
#[error(transparent)]
Expand Down
4 changes: 2 additions & 2 deletions src/index/location.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ pub(crate) fn read_cargo_config<T>(
Err(err) => return Err(Error::IoPath(err, path)),
};

let toml: toml::Value = toml::from_str(&contents)?;
let toml: toml::Value = toml::from_str(&contents).map_err(Box::new)?;
if let Some(value) = callback(&toml) {
return Ok(Some(value));
}
Expand All @@ -233,7 +233,7 @@ pub(crate) fn read_cargo_config<T>(
let path = home.join("config.toml");
if path.exists() {
let toml: toml::Value =
toml::from_str(&std::fs::read_to_string(&path)?).map_err(Error::Toml)?;
toml::from_str(&std::fs::read_to_string(&path)?).map_err(Box::new)?;
if let Some(value) = callback(&toml) {
return Ok(Some(value));
}
Expand Down

0 comments on commit 82e5a4d

Please sign in to comment.