Bigger refactorings in module layout

This commit is contained in:
Armin Ronacher 2021-02-03 00:05:54 +01:00
parent cab87515bd
commit 4770479fd7
11 changed files with 185 additions and 187 deletions

View file

@ -2,9 +2,9 @@
use std::borrow::Cow;
use std::fmt;
use crate::algorithms::{capture_diff, get_diff_ratio};
use crate::text::{DiffableStr, TextDiff};
use crate::types::{Algorithm, Change, ChangeTag, DiffOp, DiffTag};
use crate::{capture_diff, get_diff_ratio};
use std::ops::Index;
@ -139,8 +139,8 @@ impl<'s, T: DiffableStr + ?Sized> InlineChange<'s, T> {
.map(|(emphasized, raw_value)| (*emphasized, raw_value.to_string_lossy()))
}
/// Returns `true` if this change needs to be followed up by a
/// missing newline.
/// Returns `true` if this change does not end in a newline and must be
/// followed up by one if line based diffs are used.
pub fn missing_newline(&self) -> bool {
!self.values.last().map_or(true, |x| x.1.ends_with_newline())
}

View file

@ -101,8 +101,7 @@ pub use self::inline::InlineChange;
pub use self::udiff::{unified_diff, UnifiedDiff, UnifiedDiffHunk, UnifiedHunkHeader};
use self::utils::{upper_seq_ratio, QuickSeqRatio};
use crate::algorithms::{capture_diff_slices, get_diff_ratio, group_diff_ops};
use crate::types::{Algorithm, Change, DiffOp};
use crate::{capture_diff_slices, get_diff_ratio, group_diff_ops, Algorithm, Change, DiffOp};
/// A builder type config for more complex uses of [`TextDiff`].
#[derive(Clone, Debug)]