tor-config: style fixes on CfgPathError.

This commit is contained in:
Nick Mathewson 2022-06-22 08:36:13 -04:00
parent 37cbd38abc
commit c39631af27
1 changed files with 6 additions and 6 deletions

View File

@ -60,22 +60,22 @@ struct LiteralPath {
#[non_exhaustive] #[non_exhaustive]
pub enum CfgPathError { pub enum CfgPathError {
/// The path contained a variable we didn't recognize. /// The path contained a variable we didn't recognize.
#[error("unrecognized variable {0}")] #[error("Unrecognized variable {0} in path")]
UnknownVar(String), UnknownVar(String),
/// We couldn't construct a ProjectDirs object. /// We couldn't construct a ProjectDirs object.
#[error("can't construct project directories")] #[error("Can't construct project directories to resolve a path element")]
NoProjectDirs, NoProjectDirs,
/// We couldn't construct a BaseDirs object. /// We couldn't construct a BaseDirs object.
#[error("can't construct base directories")] #[error("Can't construct base directories to resolve a path element")]
NoBaseDirs, NoBaseDirs,
/// We couldn't convert a variable to UTF-8. /// We couldn't convert a variable to UTF-8.
/// ///
/// (This is due to a limitation in the shellexpand crate, which should /// (This is due to a limitation in the shellexpand crate, which should
/// be fixed in the future.) /// be fixed in the future.)
#[error("can't convert value of {0} to UTF-8")] #[error("Can't convert value of {0} to UTF-8 in path")]
BadUtf8(String), BadUtf8(String),
/// We couldn't convert a string to a valid path on the OS. /// We couldn't convert a string to a valid path on the OS.
#[error("invalid path string: {0:?}")] #[error("Invalid path string: {0:?}")]
InvalidString(String), InvalidString(String),
} }
@ -290,7 +290,7 @@ mod test {
assert!(matches!(p.path(), Err(CfgPathError::UnknownVar(_)))); assert!(matches!(p.path(), Err(CfgPathError::UnknownVar(_))));
assert_eq!( assert_eq!(
&p.path().unwrap_err().to_string(), &p.path().unwrap_err().to_string(),
"unrecognized variable ARTI_WOMBAT" "Unrecognized variable ARTI_WOMBAT in path"
); );
} }