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

@ -101,6 +101,8 @@ pub fn get_diff_ratio(ops: &[DiffOp], old_len: usize, new_len: usize) -> f32 {
/// This will leave holes behind in long periods of equal ranges so that
/// you can build things like unified diffs.
pub fn group_diff_ops(mut ops: Vec<DiffOp>, n: usize) -> Vec<Vec<DiffOp>> {
assert!(n > 0, "n must be 1 or larger");
if ops.is_empty() {
return vec![];
}