cargo fmt

pull/593/head^2
Wilfred Hughes 2023-11-19 13:10:13 +07:00
parent 8fd79c2885
commit 1dbcd08a90
3 changed files with 15 additions and 4 deletions

@ -253,7 +253,10 @@ impl<'s, 'b> Vertex<'s, 'b> {
self.lhs_syntax.is_none() && self.rhs_syntax.is_none() && self.parents.is_empty() self.lhs_syntax.is_none() && self.rhs_syntax.is_none() && self.parents.is_empty()
} }
pub(crate) fn new(lhs_syntax: Option<&'s Syntax<'s>>, rhs_syntax: Option<&'s Syntax<'s>>) -> Self { pub(crate) fn new(
lhs_syntax: Option<&'s Syntax<'s>>,
rhs_syntax: Option<&'s Syntax<'s>>,
) -> Self {
let parents = Stack::new(); let parents = Stack::new();
Vertex { Vertex {
neighbours: RefCell::new(None), neighbours: RefCell::new(None),

@ -15,7 +15,10 @@ pub(crate) enum DiffResult<T> {
/// Compute a linear diff between `lhs` and `rhs`. This is the /// Compute a linear diff between `lhs` and `rhs`. This is the
/// traditional Myer's diff algorithm. /// traditional Myer's diff algorithm.
pub(crate) fn slice<'a, T: PartialEq + Clone>(lhs: &'a [T], rhs: &'a [T]) -> Vec<DiffResult<&'a T>> { pub(crate) fn slice<'a, T: PartialEq + Clone>(
lhs: &'a [T],
rhs: &'a [T],
) -> Vec<DiffResult<&'a T>> {
wu_diff::diff(lhs, rhs) wu_diff::diff(lhs, rhs)
.into_iter() .into_iter()
.map(|result| match result { .map(|result| match result {
@ -35,7 +38,10 @@ pub(crate) fn slice<'a, T: PartialEq + Clone>(lhs: &'a [T], rhs: &'a [T]) -> Vec
/// ///
/// This is faster when equality checks on `T` are expensive, such as /// This is faster when equality checks on `T` are expensive, such as
/// large strings. /// large strings.
pub(crate) fn slice_by_hash<'a, T: Eq + Hash>(lhs: &'a [T], rhs: &'a [T]) -> Vec<DiffResult<&'a T>> { pub(crate) fn slice_by_hash<'a, T: Eq + Hash>(
lhs: &'a [T],
rhs: &'a [T],
) -> Vec<DiffResult<&'a T>> {
// Compute a unique numeric value for each item, use that for // Compute a unique numeric value for each item, use that for
// diffing, then return diff results in terms of the original // diffing, then return diff results in terms of the original
// type. // type.

@ -327,7 +327,9 @@ fn match_preceding_blanks(
res res
} }
pub(crate) fn opposite_positions(mps: &[MatchedPos]) -> DftHashMap<LineNumber, HashSet<LineNumber>> { pub(crate) fn opposite_positions(
mps: &[MatchedPos],
) -> DftHashMap<LineNumber, HashSet<LineNumber>> {
let mut res: DftHashMap<LineNumber, HashSet<LineNumber>> = DftHashMap::default(); let mut res: DftHashMap<LineNumber, HashSet<LineNumber>> = DftHashMap::default();
for mp in mps { for mp in mps {