Skip to content

Commit

Permalink
Get rid of Box on error source
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcompiles committed Jun 4, 2024
1 parent 253a1b4 commit 339350e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/parcel_config/src/config_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ pub enum ConfigError {
from: PathBuf,
specifier: String,
#[source]
source: Box<anyhow::Error>,
source: anyhow::Error,
},
}
19 changes: 10 additions & 9 deletions crates/parcel_config/src/parcel_rc_config_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use std::path::Path;
use std::path::PathBuf;
use std::rc::Rc;

use anyhow::anyhow;
use parcel_filesystem::search::find_ancestor_file;
use parcel_filesystem::FileSystem;
use parcel_package_manager::PackageManager;
Expand Down Expand Up @@ -90,7 +91,7 @@ impl ParcelRcConfigLoader {
.map_err(|source| ConfigError::UnresolvedConfig {
config_type: String::from("extended config"),
from: PathBuf::from(config_path),
source: Box::new(source),
source,
specifier: String::from(extend),
})?
.resolved
Expand All @@ -102,7 +103,7 @@ impl ParcelRcConfigLoader {
.map_err(|source| ConfigError::UnresolvedConfig {
config_type: String::from("extended config"),
from: path,
source: Box::new(anyhow::Error::new(source)),
source: anyhow!(source),
specifier: String::from(extend),
})
}
Expand Down Expand Up @@ -174,7 +175,7 @@ impl ParcelRcConfigLoader {
.map_err(|source| ConfigError::UnresolvedConfig {
config_type: String::from("config"),
from: resolve_from.clone(),
source: Box::new(source),
source,
specifier: String::from(config),
}),
None => self.find_config(project_root, &resolve_from),
Expand All @@ -189,7 +190,7 @@ impl ParcelRcConfigLoader {
.map_err(|source| ConfigError::UnresolvedConfig {
config_type: String::from("fallback"),
from: resolve_from,
source: Box::new(source),
source,
specifier: String::from(fallback_config),
});
}
Expand Down Expand Up @@ -326,7 +327,7 @@ mod tests {
config_type: String::from("extended config"),
from: config.base_config.path,
specifier: String::from("@parcel/config-default"),
source: Box::new(anyhow!("It broke")),
source: anyhow!("It broke"),
}
.to_string()
)
Expand Down Expand Up @@ -450,7 +451,7 @@ mod tests {
config_type: String::from("config"),
from: project_root.join("index"),
specifier: String::from("@scope/config"),
source: Box::new(anyhow!("It broke")),
source: anyhow!("It broke"),
}
.to_string()
)
Expand Down Expand Up @@ -487,7 +488,7 @@ mod tests {
config_type: String::from("extended config"),
from: config.base_config.path,
specifier: String::from("@parcel/config-default"),
source: Box::new(anyhow!("It broke")),
source: anyhow!("It broke"),
}
.to_string()
)
Expand Down Expand Up @@ -599,7 +600,7 @@ mod tests {
config_type: String::from("fallback"),
from: project_root.join("index"),
specifier: String::from("@parcel/config-default"),
source: Box::new(anyhow!("It broke")),
source: anyhow!("It broke"),
}
.to_string()
)
Expand Down Expand Up @@ -636,7 +637,7 @@ mod tests {
config_type: String::from("extended config"),
from: fallback.base_config.path,
specifier: String::from("@parcel/config-default"),
source: Box::new(anyhow!("It broke")),
source: anyhow!("It broke"),
}
.to_string()
),
Expand Down

0 comments on commit 339350e

Please sign in to comment.