diff rust/hg-core/src/revlog.rs @ 44973:26114bd6ec60

rust: do a clippy pass This is the result of running `cargo clippy` on hg-core/hg-cpython and fixing the lints that do not require too much code churn (and would warrant a separate commit/complete refactor) and only come from our code (a lot of warnings in hg-cpython come from `rust-cpython`). Most of those were good lints, two of them was the linter not being smart enough (or compiler to get up to `clippy`'s level depending on how you see it). Maybe in the future we could have `clippy` be part of the CI. Differential Revision: https://phab.mercurial-scm.org/D8635
author Raphaël Gomès <rgomes@octobus.net>
date Mon, 15 Jun 2020 18:26:40 +0200
parents 9896a8d0d3d2
children 26c53ee51c68
line wrap: on
line diff
--- a/rust/hg-core/src/revlog.rs	Mon Jun 15 15:14:16 2020 -0400
+++ b/rust/hg-core/src/revlog.rs	Mon Jun 15 18:26:40 2020 +0200
@@ -25,6 +25,7 @@
 ///
 /// This is also equal to `i32::max_value()`, but it's better to spell
 /// it out explicitely, same as in `mercurial.node`
+#[allow(clippy::unreadable_literal)]
 pub const WORKING_DIRECTORY_REVISION: Revision = 0x7fffffff;
 
 /// The simplest expression of what we need of Mercurial DAGs.
@@ -49,6 +50,10 @@
     /// Total number of Revisions referenced in this index
     fn len(&self) -> usize;
 
+    fn is_empty(&self) -> bool {
+        self.len() == 0
+    }
+
     /// Return a reference to the Node or `None` if rev is out of bounds
     ///
     /// `NULL_REVISION` is not considered to be out of bounds.