Skip to content

Commit a5ef43e

Browse files
committed
build_helper: apply considerable clippy suggestions
Signed-off-by: onur-ozkan <work@onurozkan.dev>
1 parent cc65413 commit a5ef43e

File tree

1 file changed

+11
-15
lines changed
  • src/tools/build_helper/src

1 file changed

+11
-15
lines changed

src/tools/build_helper/src/git.rs

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fn output_result(cmd: &mut Command) -> Result<String, String> {
2121
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
2222
));
2323
}
24-
Ok(String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))?)
24+
String::from_utf8(output.stdout).map_err(|err| format!("{err:?}"))
2525
}
2626

2727
/// Finds the remote for rust-lang/rust.
@@ -64,18 +64,14 @@ pub fn rev_exists(rev: &str, git_dir: Option<&Path>) -> Result<bool, String> {
6464
match output.status.code() {
6565
Some(0) => Ok(true),
6666
Some(128) => Ok(false),
67-
None => {
68-
return Err(format!(
69-
"git didn't exit properly: {}",
70-
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
71-
));
72-
}
73-
Some(code) => {
74-
return Err(format!(
75-
"git command exited with status code: {code}: {}",
76-
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
77-
));
78-
}
67+
None => Err(format!(
68+
"git didn't exit properly: {}",
69+
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
70+
)),
71+
Some(code) => Err(format!(
72+
"git command exited with status code: {code}: {}",
73+
String::from_utf8(output.stderr).map_err(|err| format!("{err:?}"))?
74+
)),
7975
}
8076
}
8177

@@ -96,7 +92,7 @@ pub fn updated_master_branch(
9692
}
9793
}
9894

99-
Err(format!("Cannot find any suitable upstream master branch"))
95+
Err("Cannot find any suitable upstream master branch".to_owned())
10096
}
10197

10298
pub fn get_git_merge_base(
@@ -118,7 +114,7 @@ pub fn get_git_merge_base(
118114
pub fn get_git_modified_files(
119115
config: &GitConfig<'_>,
120116
git_dir: Option<&Path>,
121-
extensions: &Vec<&str>,
117+
extensions: &[&str],
122118
) -> Result<Option<Vec<String>>, String> {
123119
let merge_base = get_git_merge_base(config, git_dir)?;
124120

0 commit comments

Comments
 (0)