Add support for Rust 1.41.0 (#14)

This commit is contained in:
Armin Ronacher 2021-02-15 22:50:12 +01:00 committed by GitHub
parent d056522da4
commit b6e2894f21
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 230 additions and 96 deletions

View file

@ -27,8 +27,9 @@
use std::ops::Range;
use std::{fmt, io};
use crate::iter::AllChangesIter;
use crate::text::{DiffableStr, TextDiff};
use crate::types::{Algorithm, Change, DiffOp};
use crate::types::{Algorithm, DiffOp};
struct MissingNewlineHint(bool);
@ -240,13 +241,13 @@ impl<'diff, 'old, 'new, 'bufs, T: DiffableStr + ?Sized>
}
/// Iterates over all changes in a hunk.
pub fn iter_changes(&self) -> impl Iterator<Item = Change<'diff, T>> + '_
pub fn iter_changes<'x, 'slf>(&'slf self) -> AllChangesIter<'slf, 'x, T>
where
'diff: 'old + 'new + 'bufs,
'x: 'slf + 'old + 'new,
'old: 'x,
'new: 'x,
{
self.ops()
.iter()
.flat_map(move |op| self.diff.iter_changes(op))
AllChangesIter::new(self.diff.old_slices(), self.diff.new_slices(), self.ops())
}
/// Write the hunk as bytes to the output stream.