Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get rid of Result in cookie method #412

Closed
StevenDoesStuffs opened this issue Mar 2, 2020 · 1 comment
Closed

Get rid of Result in cookie method #412

StevenDoesStuffs opened this issue Mar 2, 2020 · 1 comment

Comments

@StevenDoesStuffs
Copy link

The cookie method is currently implemented as so:

pub fn cookie(&self, name: &str) -> Result<Option<Cookie<'static>>, Error> {
    let cookie_data = self
        .local::<CookieData>()
        .expect("should always be set by the cookies middleware");

    let locked_jar = cookie_data.content.read().unwrap();
    Ok(locked_jar.get(name).cloned())
}

It always returns Ok, so why bother wrapping it an a Result type?

@yoshuawuyts
Copy link
Member

@StevenDoesStuffs that's a great point, let's get rid of that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants