From c73fffe62df84c42912e5d1e6cf5f7ad16babc4b Mon Sep 17 00:00:00 2001 From: Valentin Date: Wed, 2 Sep 2020 10:08:53 +0200 Subject: [PATCH] Make StatusCode::as_str return 'static str In the current version the lifetime is tied to self which is needlessly restrictive as the strings are in fact static. --- src/status.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/status.rs b/src/status.rs index 903bd82c..369eac21 100644 --- a/src/status.rs +++ b/src/status.rs @@ -125,7 +125,7 @@ impl StatusCode { /// assert_eq!(status.as_str(), "200"); /// ``` #[inline] - pub fn as_str(&self) -> &str { + pub fn as_str(&self) -> &'static str { CODES_AS_STR[(self.0 - 100) as usize] }