tor-config: paths, unexpanded: use infallible conversion

str can always be made into a PathBuf.
This commit is contained in:
Ian Jackson 2023-03-21 16:08:47 +00:00
parent 4d2140641d
commit 42ad8d99aa
1 changed files with 1 additions and 2 deletions

View File

@ -165,8 +165,7 @@ fn expand(s: &str) -> Result<PathBuf, CfgPathError> {
/// Helper: convert a string to a path without expansion.
#[cfg(not(feature = "expand-paths"))]
fn expand(s: &str) -> Result<PathBuf, CfgPathError> {
s.try_into()
.map_err(|_| CfgPathError::InvalidString(s.to_owned()))
s.into()
}
/// Shellexpand helper: return the user's home directory if we can.