Make InlineChange consistent with Change for missing_newline

This commit is contained in:
Armin Ronacher 2021-01-31 22:16:45 +01:00
parent 0a4dd224f5
commit e14b26502b
3 changed files with 5 additions and 4 deletions

View file

@ -51,7 +51,7 @@ fn main() {
print!("{}", s.apply_to(value)); print!("{}", s.apply_to(value));
} }
} }
if change.is_missing_newline() { if change.missing_newline() {
println!(); println!();
} }
} }

View file

@ -66,7 +66,7 @@ impl<'s> InlineChange<'s> {
/// Returns `true` if this change needs to be followed up by a /// Returns `true` if this change needs to be followed up by a
/// missing newline. /// missing newline.
pub fn is_missing_newline(&self) -> bool { pub fn missing_newline(&self) -> bool {
self.missing_newline self.missing_newline
} }
} }

View file

@ -155,7 +155,8 @@ impl TextDiffConfig {
/// Creates a diff of unicode words. /// Creates a diff of unicode words.
/// ///
/// This splits the text into words according to unicode rules. This is /// This splits the text into words according to unicode rules. This is
/// generally recommended over [`diff_words`] but requires a dependency. /// generally recommended over [`TextDiffConfig::diff_words`] but
/// requires a dependency.
/// ///
/// This requires the `unicode` feature. /// This requires the `unicode` feature.
#[cfg(feature = "unicode")] #[cfg(feature = "unicode")]
@ -513,7 +514,7 @@ impl<'old, 'new, 'bufs> TextDiff<'old, 'new, 'bufs> {
/// Iterates over the changes the op expands to with inline emphasis. /// Iterates over the changes the op expands to with inline emphasis.
/// ///
/// This is very similar to [`iter_changes`] but it performs a second /// This is very similar to [`TextDiff::iter_changes`] but it performs a second
/// level diff on adjacent line replacements. The exact behavior of /// level diff on adjacent line replacements. The exact behavior of
/// this function with regards to how it detects those inline changes /// this function with regards to how it detects those inline changes
/// is currently not defined and will likely change over time. /// is currently not defined and will likely change over time.