From eecf6a2294c47462153c8c3b8896c555013dcab9 Mon Sep 17 00:00:00 2001 From: cat_in_136 Date: Sat, 23 Sep 2023 20:48:44 +0900 Subject: [PATCH] refactor to fix needless_question_mark and needless_borrow --- src/config/file_info.rs | 2 +- src/config/mod.rs | 4 ++-- src/main.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/config/file_info.rs b/src/config/file_info.rs index 57a3e286..7dc0a971 100644 --- a/src/config/file_info.rs +++ b/src/config/file_info.rs @@ -117,7 +117,7 @@ impl FileInfo<'_, '_, '_, '_, '_> { parent: P, idx: usize, ) -> Result, ConfigError> { - let source = get_asset_rel_path(&self.source, build_target); + let source = get_asset_rel_path(self.source, build_target); let expanded = expand_glob(source.as_str(), self.dest, idx)?; if !expanded.is_empty() { diff --git a/src/config/mod.rs b/src/config/mod.rs index 07e0c30f..fdf17e79 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -278,10 +278,10 @@ pub(crate) fn load_script_if_path>( let relpath = file_info::get_asset_rel_path(asset, build_target); if Path::new(&relpath).exists() { - return Ok(std::fs::read_to_string(relpath)?); + return std::fs::read_to_string(relpath); } else if let Some(p) = parent.as_ref().join(&relpath).to_str() { if Path::new(&p).exists() { - return Ok(std::fs::read_to_string(p)?); + return std::fs::read_to_string(p); } } diff --git a/src/main.rs b/src/main.rs index 1577ddbf..07a0b127 100644 --- a/src/main.rs +++ b/src/main.rs @@ -126,7 +126,7 @@ mod tests { let file_name = "test.rpm"; let build_target = BuildTarget::new(&crate::cli::Cli::default()); - let target_file_name = determine_output_dir(output, &file_name, build_target); + let target_file_name = determine_output_dir(output, file_name, build_target); assert_eq!(target_file_name, tempdir.path().join("test.rpm")); } #[test] @@ -139,7 +139,7 @@ mod tests { let file_name = "test.rpm"; let build_target = BuildTarget::new(&crate::cli::Cli::default()); - let target_file_name = determine_output_dir(output, &file_name, build_target); + let target_file_name = determine_output_dir(output, file_name, build_target); assert_eq!(target_file_name, temppath); } @@ -149,7 +149,7 @@ mod tests { let file_name = "test.rpm"; let build_target = BuildTarget::new(&crate::cli::Cli::default()); - let target_file_name = determine_output_dir(output, &file_name, build_target); + let target_file_name = determine_output_dir(output, file_name, build_target); assert_eq!( target_file_name, PathBuf::from("target/generate-rpm/test.rpm")