Move empty range function into algorithm utils
This commit is contained in:
parent
1cc4ec4d25
commit
5a24bb8652
5 changed files with 10 additions and 8 deletions
|
|
@ -6,8 +6,8 @@ use std::collections::BTreeMap;
|
|||
use std::ops::{Index, Range};
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::algorithms::utils::is_empty_range;
|
||||
use crate::algorithms::DiffHook;
|
||||
use crate::utils::is_empty_range;
|
||||
|
||||
/// Hunt–McIlroy / Hunt–Szymanski LCS diff algorithm.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
mod capture;
|
||||
mod hook;
|
||||
mod replace;
|
||||
mod utils;
|
||||
|
||||
use std::hash::Hash;
|
||||
use std::ops::{Index, Range};
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@
|
|||
use std::ops::{Index, IndexMut, Range};
|
||||
use std::time::Instant;
|
||||
|
||||
use crate::algorithms::utils::is_empty_range;
|
||||
use crate::algorithms::DiffHook;
|
||||
use crate::utils::is_empty_range;
|
||||
|
||||
/// Myers' diff algorithm.
|
||||
///
|
||||
|
|
|
|||
7
src/algorithms/utils.rs
Normal file
7
src/algorithms/utils.rs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
use std::ops::Range;
|
||||
|
||||
/// Utility function to check if a range is empty that works on older rust versions
|
||||
#[inline(always)]
|
||||
pub(crate) fn is_empty_range<T: PartialOrd>(range: &Range<T>) -> bool {
|
||||
!(range.start < range.end)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue