Skip to content

Commit

Permalink
refactor to fix needless_question_mark and needless_borrow
Browse files Browse the repository at this point in the history
  • Loading branch information
cat-in-136 committed Sep 23, 2023
1 parent 01ef340 commit eecf6a2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/config/file_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl FileInfo<'_, '_, '_, '_, '_> {
parent: P,
idx: usize,
) -> Result<Vec<(PathBuf, String)>, 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() {
Expand Down
4 changes: 2 additions & 2 deletions src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,10 +278,10 @@ pub(crate) fn load_script_if_path<P: AsRef<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);
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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);
}

Expand All @@ -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")
Expand Down

0 comments on commit eecf6a2

Please sign in to comment.