Skip to content

Commit 60a5cd9

Browse files
committed
allow clippy
1 parent e78336e commit 60a5cd9

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

src/cache/cache_control/cache_control.rs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,6 @@ impl CacheControl {
8989
self.entries.push(directive);
9090
}
9191

92-
/// An iterator visiting all server entries.
93-
pub fn into_iter(self) -> IntoIter {
94-
IntoIter {
95-
inner: self.entries.into_iter(),
96-
}
97-
}
98-
9992
/// An iterator visiting all server entries.
10093
pub fn iter(&self) -> Iter<'_> {
10194
Iter {
@@ -117,7 +110,9 @@ impl IntoIterator for CacheControl {
117110

118111
#[inline]
119112
fn into_iter(self) -> Self::IntoIter {
120-
self.into_iter()
113+
IntoIter {
114+
inner: self.entries.into_iter(),
115+
}
121116
}
122117
}
123118

src/cache/cache_control/cache_directive.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ impl CacheDirective {
8787

8888
s.to_lowercase();
8989
let mut parts = s.split('=');
90-
let next = parts.next().unwrap().clone();
90+
let next = parts.next().unwrap();
9191

9292
let mut get_dur = || -> crate::Result<Duration> {
9393
let dur = parts.next().status(400)?;
@@ -130,21 +130,21 @@ impl From<CacheDirective> for HeaderValue {
130130
let h = |s: String| unsafe { HeaderValue::from_bytes_unchecked(s.into_bytes()) };
131131

132132
match directive {
133-
Immutable => h(format!("immutable")),
133+
Immutable => h("immutable".to_string()),
134134
MaxAge(dur) => h(format!("max-age={}", dur.as_secs())),
135135
MaxStale(dur) => match dur {
136136
Some(dur) => h(format!("max-stale={}", dur.as_secs())),
137-
None => h(format!("max-stale")),
137+
None => h("max-stale".to_string()),
138138
},
139139
MinFresh(dur) => h(format!("min-fresh={}", dur.as_secs())),
140-
MustRevalidate => h(format!("must-revalidate")),
141-
NoCache => h(format!("no-cache")),
142-
NoStore => h(format!("no-store")),
143-
NoTransform => h(format!("no-transform")),
144-
OnlyIfCached => h(format!("only-if-cached")),
145-
Private => h(format!("private")),
146-
ProxyRevalidate => h(format!("proxy-revalidate")),
147-
Public => h(format!("public")),
140+
MustRevalidate => h("must-revalidate".to_string()),
141+
NoCache => h("no-cache".to_string()),
142+
NoStore => h("no-store".to_string()),
143+
NoTransform => h("no-transform".to_string()),
144+
OnlyIfCached => h("only-if-cached".to_string()),
145+
Private => h("private".to_string()),
146+
ProxyRevalidate => h("proxy-revalidate".to_string()),
147+
Public => h("public".to_string()),
148148
SMaxAge(dur) => h(format!("s-max-age={}", dur.as_secs())),
149149
StaleIfError(dur) => h(format!("stale-if-error={}", dur.as_secs())),
150150
StaleWhileRevalidate(dur) => h(format!("stale-while-revalidate={}", dur.as_secs())),

src/cache/cache_control/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//! - [RFC 7234: Hypertext Transfer Protocol (HTTP/1.1): Caching](https://tools.ietf.org/html/rfc7234)
77
//! - [RFC 8246: HTTP Immutable Responses](https://tools.ietf.org/html/rfc8246)
88
9+
#[allow(clippy::module_inception)]
910
mod cache_control;
1011
mod cache_directive;
1112

0 commit comments

Comments
 (0)