Use MAX associated const (#9196)

* Use MAX associated const
This commit is contained in:
Squirrel
2021-06-24 11:53:49 +01:00
committed by GitHub
parent 09d9c2c9f6
commit ea1f21a904
56 changed files with 178 additions and 178 deletions
@@ -97,7 +97,7 @@ impl Era {
/// Get the block number of the first block at which the era has ended.
pub fn death(self, current: u64) -> u64 {
match self {
Self::Immortal => u64::max_value(),
Self::Immortal => u64::MAX,
Self::Mortal(period, _) => self.birth(current) + period,
}
}
@@ -145,11 +145,11 @@ mod tests {
fn immortal_works() {
let e = Era::immortal();
assert_eq!(e.birth(0), 0);
assert_eq!(e.death(0), u64::max_value());
assert_eq!(e.death(0), u64::MAX);
assert_eq!(e.birth(1), 0);
assert_eq!(e.death(1), u64::max_value());
assert_eq!(e.birth(u64::max_value()), 0);
assert_eq!(e.death(u64::max_value()), u64::max_value());
assert_eq!(e.death(1), u64::MAX);
assert_eq!(e.birth(u64::MAX), 0);
assert_eq!(e.death(u64::MAX), u64::MAX);
assert!(e.is_immortal());
assert_eq!(e.encode(), vec![0u8]);