From 2d1bc823274e351b2b413a640bc71aa4d5d6c798 Mon Sep 17 00:00:00 2001 From: Stan Bondi Date: Tue, 10 Jan 2023 14:26:33 +0400 Subject: [PATCH] fix: add const to FixedHash::zero (#5084) Description --- Make `FixedHash::zero` a const fn Motivation and Context --- A function returning a constant value should be set as const to allow for minor compiled code optimisations. A zero hash is used more often in the DAN layer to indicate a genesis node. How Has This Been Tested? --- Minor change, clippy passes --- base_layer/common_types/src/types/fixed_hash.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_layer/common_types/src/types/fixed_hash.rs b/base_layer/common_types/src/types/fixed_hash.rs index f1be1dd722..39c98c5574 100644 --- a/base_layer/common_types/src/types/fixed_hash.rs +++ b/base_layer/common_types/src/types/fixed_hash.rs @@ -59,7 +59,7 @@ impl FixedHash { 32 } - pub fn zero() -> Self { + pub const fn zero() -> Self { Self(ZERO_HASH) }