rust-changelog: removed now useless early conditional for NULL_REVISION stable
authorGeorges Racinet <georges.racinet@octobus.net>
Thu, 06 Jul 2023 11:58:24 +0200
branchstable
changeset 50747 9865af7191d2
parent 50746 124c44b5cfad
child 50748 3ffc7209bbae
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`.
rust/hg-core/src/revlog/changelog.rs
--- a/rust/hg-core/src/revlog/changelog.rs	Thu Jul 06 11:53:40 2023 +0200
+++ b/rust/hg-core/src/revlog/changelog.rs	Thu Jul 06 11:58:24 2023 +0200
@@ -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 @@
         &self,
         rev: Revision,
     ) -> Result<ChangelogRevisionData, RevlogError> {
-        if rev == NULL_REVISION {
-            return Ok(ChangelogRevisionData::null());
-        }
         self.entry_for_rev(rev)?.data()
     }