mirror of
https://github.com/watchexec/watchexec.git
synced 2024-09-30 07:01:34 +02:00
Clippy
This commit is contained in:
parent
a0a9aae295
commit
dbfd150bb6
@ -257,7 +257,7 @@ mod git {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn read_commit(repo: &Path, hash: &oid) -> Result<Vec<u8>, String> {
|
pub fn read_commit(repo: &Path, hash: &oid) -> Result<Vec<u8>, String> {
|
||||||
if let Some(path) = object_file(&repo, &hash) {
|
if let Some(path) = object_file(repo, hash) {
|
||||||
let mut file = File::open(path).err_string()?;
|
let mut file = File::open(path).err_string()?;
|
||||||
|
|
||||||
let size = file.metadata().err_string()?.len() as usize;
|
let size = file.metadata().err_string()?.len() as usize;
|
||||||
@ -269,7 +269,7 @@ mod git {
|
|||||||
flate.once(&raw, &mut buf).err_string()?;
|
flate.once(&raw, &mut buf).err_string()?;
|
||||||
Ok(buf)
|
Ok(buf)
|
||||||
} else {
|
} else {
|
||||||
let (pack_path, offset) = find_in_index(&repo, &hash)?.ok_or_else(|| {
|
let (pack_path, offset) = find_in_index(repo, hash)?.ok_or_else(|| {
|
||||||
String::from("HEAD is a packed ref, but can't find it in git pack")
|
String::from("HEAD is a packed ref, but can't find it in git pack")
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -286,8 +286,7 @@ mod git {
|
|||||||
.ok_or_else(|| String::from("HEAD has no committer"))?;
|
.ok_or_else(|| String::from("HEAD has no committer"))?;
|
||||||
let date_s = &commit[committer_line_offset..]
|
let date_s = &commit[committer_line_offset..]
|
||||||
.split(|b| *b == b' ')
|
.split(|b| *b == b' ')
|
||||||
.skip(3)
|
.nth(3)
|
||||||
.next()
|
|
||||||
.ok_or_else(|| String::from("malformed committer in commit"))
|
.ok_or_else(|| String::from("malformed committer in commit"))
|
||||||
.and_then(|s| std::str::from_utf8(s).err_string())
|
.and_then(|s| std::str::from_utf8(s).err_string())
|
||||||
.and_then(|s| i64::from_str(s).err_string())?;
|
.and_then(|s| i64::from_str(s).err_string())?;
|
||||||
|
Loading…
Reference in New Issue
Block a user