surf: missed expect from refactoring diff

A placeholder `.expect("TODO")` was left in the diff code while
refactoring.

Change the `expect` to `?` and use the correct `type Error`.

Signed-off-by: Fintan Halpenny <fintan.halpenny@gmail.com>
X-Clacks-Overhead: GNU Terry Pratchett
This commit is contained in:
Fintan Halpenny
2022-12-16 11:00:16 +00:00
parent 8d451e3d9d
commit 01e2305a41
+2 -2
View File
@@ -129,7 +129,7 @@ impl TryFrom<git2::Patch<'_>> for Hunks<Addition> {
}
impl TryFrom<git2::Patch<'_>> for Hunks<Deletion> {
type Error = git2::Error;
type Error = error::Deletion;
fn try_from(patch: git2::Patch) -> Result<Self, Self::Error> {
let mut hunks = Vec::with_capacity(patch.num_hunks());
@@ -140,7 +140,7 @@ impl TryFrom<git2::Patch<'_>> for Hunks<Deletion> {
for l in 0..hunk_lines {
let line = patch.line_in_hunk(h, l)?;
lines.push(Deletion::try_from(line).expect("TODO"));
lines.push(Deletion::try_from(line)?);
}
hunks.push(Hunk { header, lines })
}