Patchwork D11548: hg-core: silence dead-code warning by adding RevlogEntry::revion() accessor

login
register
mail settings
Submitter phabricator
Date Oct. 1, 2021, 3:46 p.m.
Message ID <differential-rev-PHID-DREV-pyndkn7bls2a3lcfx4ek-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49872/
State Superseded
Headers show

Comments

phabricator - Oct. 1, 2021, 3:46 p.m.
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Nightly `rustc` warns about the `RevlogEntry::rev` field not being
  used. Rather than removing it, I added an accessor since it seems
  useful to be able to get the entry's revision.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11548

AFFECTED FILES
  rust/hg-core/src/revlog/revlog.rs

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/src/revlog/revlog.rs b/rust/hg-core/src/revlog/revlog.rs
--- a/rust/hg-core/src/revlog/revlog.rs
+++ b/rust/hg-core/src/revlog/revlog.rs
@@ -304,6 +304,10 @@ 
 }
 
 impl<'a> RevlogEntry<'a> {
+    pub fn revision(&self) -> Revision {
+        self.rev
+    }
+
     /// Extract the data contained in the entry.
     pub fn data(&self) -> Result<Cow<'_, [u8]>, RevlogError> {
         if self.bytes.is_empty() {