Skip to content

Commit

Permalink
Give rejection names a finite lifetime
Browse files Browse the repository at this point in the history
In case the way headers are handled is changed at a later date, this
change prevents commitments to how long returned references to rejection
related names should live.

Rather than the static lifetime these references will now live for as
long rejections themselves.
  • Loading branch information
johnchildren committed Feb 18, 2020
1 parent 9d06cd2 commit 29c717a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/reject.rs
Expand Up @@ -506,9 +506,9 @@ pub struct MissingHeader {
name: &'static str,
}

impl MissingHeader {
impl<'a> MissingHeader {
/// Retrieve the name of the header that was missing
pub fn name(self) -> &'static str {
pub fn name(self) -> &'a str {
self.name
}
}
Expand All @@ -527,9 +527,9 @@ pub struct InvalidHeader {
name: &'static str,
}

impl InvalidHeader {
impl<'a> InvalidHeader {
/// Retrieve the name of the header that was invalid
pub fn name(self) -> &'static str {
pub fn name(self) -> &'a str {
self.name
}
}
Expand All @@ -548,9 +548,9 @@ pub struct MissingCookie {
name: &'static str,
}

impl MissingCookie {
impl<'a> MissingCookie {
/// Retrieve the name of the cookie that was missing
pub fn name(self) -> &'static str {
pub fn name(self) -> &'a str {
self.name
}
}
Expand Down

0 comments on commit 29c717a

Please sign in to comment.