Mercurial > public > mercurial-scm > hg
comparison rust/hg-core/src/revlog/index.rs @ 51689:918ceb5a3d25
rust: apply clippy lints
They are at most harmless and at best make the codebase more readable and
simpler.
author | Rapha?l Gom?s <rgomes@octobus.net> |
---|---|
date | Thu, 18 Jul 2024 13:35:39 +0200 |
parents | d2858d97af6c |
children | 7f0cb9ee0534 |
comparison
equal
deleted
inserted
replaced
51688:771598067be2 | 51689:918ceb5a3d25 |
---|---|
1385 /// and having constant capacity typically can have a very simple | 1385 /// and having constant capacity typically can have a very simple |
1386 /// implementation. | 1386 /// implementation. |
1387 fn vec_of_empty(sets_size: usize, vec_len: usize) -> Vec<Self>; | 1387 fn vec_of_empty(sets_size: usize, vec_len: usize) -> Vec<Self>; |
1388 | 1388 |
1389 /// The size of the bit mask in memory | 1389 /// The size of the bit mask in memory |
1390 #[allow(unused)] | |
1390 fn size(&self) -> usize; | 1391 fn size(&self) -> usize; |
1391 | 1392 |
1392 /// The number of elements that can be represented in the set. | 1393 /// The number of elements that can be represented in the set. |
1393 /// | 1394 /// |
1394 /// Another way to put it is that it is the highest integer `C` such that | 1395 /// Another way to put it is that it is the highest integer `C` such that |
1395 /// the set is guaranteed to always be a subset of the integer range | 1396 /// the set is guaranteed to always be a subset of the integer range |
1396 /// `[0, C)` | 1397 /// `[0, C)` |
1398 #[allow(unused)] | |
1397 fn capacity(&self) -> usize; | 1399 fn capacity(&self) -> usize; |
1398 | 1400 |
1399 /// Declare `n` to belong to the set | 1401 /// Declare `n` to belong to the set |
1400 fn add(&mut self, n: usize); | 1402 fn add(&mut self, n: usize); |
1401 | 1403 |
1402 /// Declare `n` not to belong to the set | 1404 /// Declare `n` not to belong to the set |
1405 #[allow(unused)] | |
1403 fn discard(&mut self, n: usize); | 1406 fn discard(&mut self, n: usize); |
1404 | 1407 |
1405 /// Replace this bit set by its union with other | 1408 /// Replace this bit set by its union with other |
1406 fn union(&mut self, other: &Self); | 1409 fn union(&mut self, other: &Self); |
1407 | 1410 |
1745 | 1748 |
1746 pub fn as_bytes(&self) -> &'a [u8] { | 1749 pub fn as_bytes(&self) -> &'a [u8] { |
1747 self.bytes | 1750 self.bytes |
1748 } | 1751 } |
1749 } | 1752 } |
1753 | |
1754 #[cfg(test)] | |
1755 pub use tests::IndexEntryBuilder; | |
1750 | 1756 |
1751 #[cfg(test)] | 1757 #[cfg(test)] |
1752 mod tests { | 1758 mod tests { |
1753 use super::*; | 1759 use super::*; |
1754 use crate::node::NULL_NODE; | 1760 use crate::node::NULL_NODE; |
2025 .build(); | 2031 .build(); |
2026 | 2032 |
2027 assert_eq!(get_version(&bytes), 2) | 2033 assert_eq!(get_version(&bytes), 2) |
2028 } | 2034 } |
2029 } | 2035 } |
2030 | |
2031 #[cfg(test)] | |
2032 pub use tests::IndexEntryBuilder; |