Merge branch 'refactor-anyhow-arti-crate' into 'main'

Remove `anyhow` from `tor-config` crate

See merge request tpo/core/arti!707
This commit is contained in:
Nick Mathewson 2022-08-31 13:14:46 +00:00
commit 8d6a1ea6ec
4 changed files with 4 additions and 6 deletions

1
Cargo.lock generated
View File

@ -3593,7 +3593,6 @@ dependencies = [
name = "tor-config"
version = "0.5.0"
dependencies = [
"anyhow",
"config",
"derive_builder_fork_arti",
"directories",

View File

@ -16,7 +16,6 @@ default = ["expand-paths"]
expand-paths = ["shellexpand", "directories"]
[dependencies]
anyhow = "1.0.23"
config = { version = "0.13", default-features = false, features = ["toml"] }
derive_builder = { version = "0.11.2", package = "derive_builder_fork_arti" }
directories = { version = "4", optional = true }
@ -38,7 +37,6 @@ tor-error = { path = "../tor-error", version = "0.3.2" }
tracing = "0.1.18"
[dev-dependencies]
anyhow = "1.0.23"
config = { version = "0.13", default-features = false, features = ["toml"] }
dirs = "4.0.0"
rmp-serde = "1"

View File

@ -43,7 +43,7 @@
//! but not recognized by *any* of the three config consumers,
//!
//! ```
//! # fn main() -> Result<(), anyhow::Error> {
//! # fn main() -> Result<(), tor_config::load::ConfigResolveError> {
//! use derive_builder::Builder;
//! use tor_config::{impl_standard_builder, resolve, ConfigBuildError, ConfigurationSources};
//! use tor_config::load::TopLevel;

View File

@ -243,11 +243,12 @@ impl ConfigurationSources {
if e.kind() == io::ErrorKind::NotFound && !required {
Result::<_, crate::ConfigError>::Ok(())
} else {
Err(foreign_err(anyhow::anyhow!(format!(
Err(config::ConfigError::Message(format!(
"unable to access config path: {:?}: {}",
&source.as_path(),
e
))))
))
.into())
}
};