Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ description = """
HTTP cookie parsing and cookie jar management. Supports signed and private
(encrypted, authenticated) jars.
"""
include = ["Cargo.toml", "CHANGELOG.md", "README.md", "LICENSE-APACHE", "LICENSE-MIT", "build.rs", "src/**/*.rs"]

[features]
percent-encode = ["percent-encoding"]
Expand All @@ -38,3 +39,6 @@ version_check = "0.9.4"

[package.metadata.docs.rs]
all-features = true

[lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(nightly)'] }
16 changes: 5 additions & 11 deletions src/jar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ impl CookieJar {
/// // Delta contains two new cookies ("new", "yac") and a removal ("name").
/// assert_eq!(jar.delta().count(), 3);
/// ```
pub fn delta(&self) -> Delta {
pub fn delta(&self) -> Delta<'_> {
Delta { iter: self.delta_cookies.iter() }
}

Expand Down Expand Up @@ -374,7 +374,7 @@ impl CookieJar {
/// }
/// }
/// ```
pub fn iter(&self) -> Iter {
pub fn iter(&self) -> Iter<'_> {
Iter {
delta_cookies: self.delta_cookies.iter()
.chain(self.original_cookies.difference(&self.delta_cookies)),
Expand Down Expand Up @@ -540,7 +540,7 @@ impl CookieJar {
/// assert!(matches!(jar.prefixed(Secure).get("h0st"), None));
/// ```
#[inline(always)]
pub fn prefixed<'a, P: Prefix>(&'a self, prefix: P) -> PrefixedJar<P, &'a Self> {
pub fn prefixed<P: Prefix>(&self, prefix: P) -> PrefixedJar<P, &Self> {
let _ = prefix;
PrefixedJar::new(self)
}
Expand Down Expand Up @@ -580,7 +580,7 @@ impl CookieJar {
/// jar.prefixed_mut(Host).remove("one");
/// assert!(jar.prefixed(Host).get("one").is_none());
/// ```
pub fn prefixed_mut<'a, P: Prefix>(&'a mut self, prefix: P) -> PrefixedJar<P, &'a mut Self> {
pub fn prefixed_mut<P: Prefix>(&mut self, prefix: P) -> PrefixedJar<P, &mut Self> {
let _ = prefix;
PrefixedJar::new(self)
}
Expand Down Expand Up @@ -614,13 +614,7 @@ impl<'a> Iterator for Iter<'a> {
type Item = &'a Cookie<'static>;

fn next(&mut self) -> Option<&'a Cookie<'static>> {
for cookie in self.delta_cookies.by_ref() {
if !cookie.removed {
return Some(&*cookie);
}
}

None
self.delta_cookies.by_ref().find(|&cookie| !cookie.removed).map(|v| v as _)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ impl<'c> CookieStr<'c> {
converting indexed str to str! (This is a module invariant.)");
&s[i..j]
},
CookieStr::Concrete(ref cstr) => &*cstr,
CookieStr::Concrete(ref cstr) => cstr,
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ fn parse_inner<'c>(s: &str, decode: bool) -> Result<Cookie<'c>, ParseError> {
v = &v[1..];
}

if !v.chars().all(|d| d.is_digit(10)) {
if !v.chars().all(|d| d.is_ascii_digit()) {
continue
}

Expand All @@ -164,7 +164,7 @@ fn parse_inner<'c>(s: &str, decode: bool) -> Result<Cookie<'c>, ParseError> {
} else {
Some(v.parse::<i64>()
.map(Duration::seconds)
.unwrap_or_else(|_| Duration::seconds(i64::max_value())))
.unwrap_or_else(|_| Duration::seconds(i64::MAX)))
}
},
("domain", Some(d)) if !d.is_empty() => {
Expand Down