From 935a47dd8c2e23463a02ae41ab922beddfacb575 Mon Sep 17 00:00:00 2001 From: Smitty Date: Sat, 29 May 2021 13:33:16 -0400 Subject: [PATCH] make Qid::unit_suffix const --- src/ids.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ids.rs b/src/ids.rs index 8eb175b..4e6438c 100755 --- a/src/ids.rs +++ b/src/ids.rs @@ -107,9 +107,9 @@ macro_rules! pid_consts ( macro_rules! qid_unit_suffixes { { $($key:ident => $value:expr),+, } => { #[must_use] - pub(super) fn unit_suffix(qid: Qid) -> Option<&'static str> { + pub(super) const fn unit_suffix(qid: Qid) -> Option<&'static str> { $( - if qid == $key { + if qid.0 == ($key).0 { Some($value) } else )+ @@ -123,7 +123,7 @@ macro_rules! qid_unit_suffixes { impl Qid { /// If the Qid is a commonly used unit on Wikidata, get it as a unit suffix. #[must_use] - pub fn unit_suffix(self) -> Option<&'static str> { + pub const fn unit_suffix(self) -> Option<&'static str> { consts::unit_suffix(self) } }