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
@@ -7,6 +7,7 @@ Main program for `pacdef`. All internal logic happens in [`pacdef_core`].
clippy::option_if_let_else, clippy::option_if_let_else,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,
clippy::semicolon_if_nothing_returned, clippy::semicolon_if_nothing_returned,
clippy::unnecessary_wraps,
clippy::unused_self, clippy::unused_self,
clippy::unwrap_used, clippy::unwrap_used,
clippy::use_debug, clippy::use_debug,
+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::option_if_let_else,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,
clippy::semicolon_if_nothing_returned, clippy::semicolon_if_nothing_returned,
clippy::unnecessary_wraps,
clippy::unused_self, clippy::unused_self,
clippy::unwrap_used, clippy::unwrap_used,
clippy::use_debug, clippy::use_debug,
+12 -9
View File
@@ -123,15 +123,18 @@ where
/// For each file argument, return the absolute path to the file. /// For each file argument, return the absolute path to the file.
pub(crate) fn get_absolutized_file_paths(arg_match: &[String]) -> Result<Vec<PathBuf>> { pub(crate) fn get_absolutized_file_paths(arg_match: &[String]) -> Result<Vec<PathBuf>> {
Ok(arg_match let mut result = vec![];
.iter()
.map(PathBuf::from) for item in arg_match {
.map(|path| { let path: PathBuf = item.into();
path.absolutize() let absolute = path
.expect("absolute path should exist") .absolutize()
.into_owned() .with_context(|| format!("absolutizing {path:?}"))?
}) .into_owned();
.collect()) result.push(absolute);
}
Ok(result)
} }
#[cfg(test)] #[cfg(test)]
+1
View File
@@ -13,6 +13,7 @@ Procedural macros for `pacdef`.
clippy::option_if_let_else, clippy::option_if_let_else,
clippy::redundant_pub_crate, clippy::redundant_pub_crate,
clippy::semicolon_if_nothing_returned, clippy::semicolon_if_nothing_returned,
clippy::unnecessary_wraps,
clippy::unused_self, clippy::unused_self,
clippy::unwrap_used, clippy::unwrap_used,
clippy::use_debug, clippy::use_debug,