Use Context suffix for snafu error contexts (#1068)

This commit is contained in:
Casey Rodarmor 2022-01-04 09:45:27 -08:00 committed by GitHub
parent c89dad9498
commit edf1fbd83b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -416,7 +416,7 @@ impl Config {
} }
pub(crate) fn from_matches(matches: &ArgMatches) -> ConfigResult<Self> { pub(crate) fn from_matches(matches: &ArgMatches) -> ConfigResult<Self> {
let invocation_directory = env::current_dir().context(config_error::CurrentDirSnafu)?; let invocation_directory = env::current_dir().context(config_error::CurrentDirContext)?;
let verbosity = if matches.is_present(arg::QUIET) { let verbosity = if matches.is_present(arg::QUIET) {
Verbosity::Quiet Verbosity::Quiet

View File

@ -1,7 +1,7 @@
use crate::common::*; use crate::common::*;
#[derive(Debug, Snafu)] #[derive(Debug, Snafu)]
#[snafu(visibility(pub(crate)))] #[snafu(visibility(pub(crate)), context(suffix(Context)))]
pub(crate) enum ConfigError { pub(crate) enum ConfigError {
#[snafu(display("Failed to get current directory: {}", source))] #[snafu(display("Failed to get current directory: {}", source))]
CurrentDir { source: io::Error }, CurrentDir { source: io::Error },