Showing the changes to gitoxide-core/src/commitgraph (1 of 11 files). Show all
Unified · Split
| @@ -22,10 +22,10 @@ impl Default for Context<Vec<u8>, Vec<u8>> { · 21 unmodified lines | ||
| 22 | 22 | pub(crate) mod function { |
| 23 | 23 | use std::{io, path::Path}; |
| 24 | 24 | |
| 25 | − use anyhow::{Context as AnyhowContext, Result}; | |
| 26 | − use gix::commitgraph::{verify::Outcome, Graph}; | |
| 27 | − | |
| 28 | 25 | use crate::OutputFormat; |
| 26 | + use anyhow::Result; | |
| 27 | + use gix::commitgraph::{verify::Outcome, Graph}; | |
| 28 | + use gix::Exn; | |
| 29 | 29 | |
| 30 | 30 | pub fn verify<W1, W2>( |
| 31 | 31 | path: impl AsRef<Path>, |
| @@ -34,20 +34,18 @@ pub(crate) mod function { · 2 unmodified lines | ||
| 34 | 34 | mut out, |
| 35 | 35 | output_statistics, |
| 36 | 36 | }: super::Context<W1, W2>, |
| 37 | − ) -> Result<gix::commitgraph::verify::Outcome> | |
| 37 | + ) -> Result<Outcome> | |
| 38 | 38 | where |
| 39 | 39 | W1: io::Write, |
| 40 | 40 | W2: io::Write, |
| 41 | 41 | { |
| 42 | − let g = Graph::at(path.as_ref()).with_context(|| "Could not open commit graph")?; | |
| 42 | + let g = Graph::at(path.as_ref()).map_err(Exn::into_error)?; | |
| 43 | 43 | |
| 44 | 44 | #[allow(clippy::unnecessary_wraps, unknown_lints)] |
| 45 | 45 | fn noop_processor(_commit: &gix::commitgraph::file::Commit<'_>) -> std::result::Result<(), std::fmt::Error> { |
| 46 | 46 | Ok(()) |
| 47 | 47 | } |
| 48 | − let stats = g | |
| 49 | − .verify_integrity(noop_processor) | |
| 50 | − .with_context(|| "Verification failure")?; | |
| 48 | + let stats = g.verify_integrity(noop_processor).map_err(Exn::into_error)?; | |
| 51 | 49 | |
| 52 | 50 | #[cfg_attr(not(feature = "serde"), allow(clippy::single_match))] |
| 53 | 51 | match output_statistics { |