refact: unncessary wraps

This commit is contained in:
steven-omaha
2023-06-02 14:02:12 +02:00
parent 89fc17c473
commit c3f73cb4fa
4 changed files with 15 additions and 9 deletions
+1
View File
@@ -13,6 +13,7 @@ This library contains all logic that happens in `pacdef` under the hood.
clippy::option_if_let_else,
clippy::redundant_pub_crate,
clippy::semicolon_if_nothing_returned,
clippy::unnecessary_wraps,
clippy::unused_self,
clippy::unwrap_used,
clippy::use_debug,
+12 -9
View File
@@ -123,15 +123,18 @@ where
/// For each file argument, return the absolute path to the file.
pub(crate) fn get_absolutized_file_paths(arg_match: &[String]) -> Result<Vec<PathBuf>> {
Ok(arg_match
.iter()
.map(PathBuf::from)
.map(|path| {
path.absolutize()
.expect("absolute path should exist")
.into_owned()
})
.collect())
let mut result = vec![];
for item in arg_match {
let path: PathBuf = item.into();
let absolute = path
.absolutize()
.with_context(|| format!("absolutizing {path:?}"))?
.into_owned();
result.push(absolute);
}
Ok(result)
}
#[cfg(test)]