clippy: remove redundant .collect::<Vec<_>>()

Closes #11214
This commit is contained in:
lengyijun
2025-03-04 12:53:02 +08:00
committed by Johannes Altmanninger
parent e1be842167
commit 67e95a1ce7

View File

@@ -327,7 +327,7 @@ fn get_git_hash() -> Result<String, Box<dyn std::error::Error>> {
// .git/HEAD contains ref: refs/heads/branch
let headpath = gitdir.join("HEAD");
let headstr = read_to_string(headpath)?;
let headref = headstr.split(' ').collect::<Vec<_>>()[1].trim();
let headref = headstr.split(' ').nth(1).unwrap().trim();
// .git/refs/heads/branch contains the SHA
let refpath = gitdir.join(headref);