Raise an explicit panic when context_lines is 0. Fixes #37

This commit is contained in:
Armin Ronacher 2022-07-28 15:14:54 +02:00
parent 3c784d6e9d
commit 3a938ae1d3
3 changed files with 13 additions and 1 deletions

View file

@ -139,7 +139,8 @@ impl<'diff, 'old, 'new, 'bufs, T: DiffableStr + ?Sized> UnifiedDiff<'diff, 'old,
/// Changes the context radius.
///
/// The context radius is the number of lines between changes that should
/// be emitted. This defaults to `3`.
/// be emitted. This defaults to `3`. This value must be one or larger or
/// creating the diff will panic.
pub fn context_radius(&mut self, n: usize) -> &mut Self {
self.context_radius = n;
self