Import Debug instead of full reference

This commit is contained in:
Andras Schmelczer 2025-06-29 15:57:04 +01:00
parent c1aa8fe463
commit d23fad5382
8 changed files with 29 additions and 18 deletions

View file

@ -1,7 +1,9 @@
use std::fmt::Debug;
use crate::Token;
/// Given two lists of tokens, returns `length` where `old` list somewhere
/// within contains the `length` prefix of the `new` list.
/// Given two lists of tokens, returns `length` where the `old` list
/// somewhere within contains the `length` prefix of the `new` list.
///
/// ## Example
///
@ -25,7 +27,7 @@ use crate::Token;
/// > results in a length of 1
pub fn find_longest_prefix_contained_within<T>(old: &[Token<T>], new: &[Token<T>]) -> usize
where
T: PartialEq + Clone + std::fmt::Debug,
T: PartialEq + Clone + Debug,
{
let max_possible = new.len().min(old.len());

View file

@ -20,6 +20,7 @@
//! For potential improvements here see [similar#15](https://github.com/mitsuhiko/similar/issues/15).
use std::{
fmt::Debug,
ops::{Index, IndexMut, Range},
vec,
};
@ -38,7 +39,7 @@ use crate::{
/// The returned `RawOperations` each wrap a single token.
pub fn myers_diff<T>(old: &[Token<T>], new: &[Token<T>]) -> Vec<RawOperation<T>>
where
T: PartialEq + Clone + std::fmt::Debug,
T: PartialEq + Clone + Debug,
{
let max_d = (old.len() + new.len()).div_ceil(2) + 1;
let mut vb = V::new(max_d);
@ -130,7 +131,7 @@ fn find_middle_snake<T>(
vb: &mut V,
) -> Option<(usize, usize)>
where
T: PartialEq + Clone + std::fmt::Debug,
T: PartialEq + Clone + Debug,
{
let n = old_range.len();
let m = new_range.len();
@ -236,7 +237,7 @@ fn conquer<T>(
vb: &mut V,
result: &mut Vec<RawOperation<T>>,
) where
T: PartialEq + Clone + std::fmt::Debug,
T: PartialEq + Clone + Debug,
{
// Check for common prefix
let common_prefix_len = common_prefix_len(old, old_range.clone(), new, new_range.clone());