# HG changeset patch # User Georges Racinet # Date 2023-07-06 09:58:24 # Node ID 9865af7191d21fd5853eb0f24b8154753551dc90 # Parent 124c44b5cfad1dbfff6f078d5b61bdc6903a1a30 rust-changelog: removed now useless early conditional for NULL_REVISION Now that the underlying `RevlogEntry` returned for `NULL_REVISION` is viable, it has become pointless to check NULL_REVISION several times, even for performance: the check will be far more frequent than the benefit of bailing earlier in the rare case where the requested revision is `NULL_REVISION`. This case is covered explicitly by the first assertion of `test_data_from_rev_null`. diff --git a/rust/hg-core/src/revlog/changelog.rs b/rust/hg-core/src/revlog/changelog.rs --- a/rust/hg-core/src/revlog/changelog.rs +++ b/rust/hg-core/src/revlog/changelog.rs @@ -1,6 +1,6 @@ use crate::errors::HgError; +use crate::revlog::Revision; use crate::revlog::{Node, NodePrefix}; -use crate::revlog::{Revision, NULL_REVISION}; use crate::revlog::{Revlog, RevlogEntry, RevlogError}; use crate::utils::hg_path::HgPath; use crate::vfs::Vfs; @@ -51,9 +51,6 @@ impl Changelog { &self, rev: Revision, ) -> Result { - if rev == NULL_REVISION { - return Ok(ChangelogRevisionData::null()); - } self.entry_for_rev(rev)?.data() }