Skip to content

Commit

Permalink
use range instead of handcoded bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
trinity-1686a committed Nov 6, 2023
1 parent 011714c commit 329e35e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/directory/footer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ impl Footer {
/// Confirms that the index will be read correctly by this version of tantivy
/// Has to be called after `extract_footer` to make sure it's not accessing uninitialised memory
pub fn is_compatible(&self) -> Result<(), Incompatibility> {
const SUPPORTED_INDEX_FORMAT_VERSION_RANGE: std::ops::RangeInclusive<u32> =
INDEX_FORMAT_OLDEST_SUPPORTED_VERSION..=INDEX_FORMAT_VERSION;

let library_version = crate::version();
if self.version.index_format_version < INDEX_FORMAT_OLDEST_SUPPORTED_VERSION
|| self.version.index_format_version > INDEX_FORMAT_VERSION
{
if !SUPPORTED_INDEX_FORMAT_VERSION_RANGE.contains(&self.version.index_format_version) {
return Err(Incompatibility::IndexMismatch {
library_version: library_version.clone(),
index_version: self.version.clone(),
Expand Down

0 comments on commit 329e35e

Please sign in to comment.