Skip to content

Commit bfb8ea8

Browse files
caspervonbJarema
authored andcommitted
Remove From<HeaderValue> for String and str
1 parent 480b24b commit bfb8ea8

File tree

1 file changed

+3
-21
lines changed

1 file changed

+3
-21
lines changed

async-nats/src/header.rs

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -243,24 +243,6 @@ impl AsRef<str> for HeaderValue {
243243
}
244244
}
245245

246-
impl From<HeaderValue> for String {
247-
fn from(header: HeaderValue) -> Self {
248-
header.to_string()
249-
}
250-
}
251-
252-
impl From<&HeaderValue> for String {
253-
fn from(header: &HeaderValue) -> Self {
254-
header.to_string()
255-
}
256-
}
257-
258-
impl<'a> From<&'a HeaderValue> for &'a str {
259-
fn from(header: &'a HeaderValue) -> Self {
260-
header.inner.as_str()
261-
}
262-
}
263-
264246
impl FromStr for HeaderValue {
265247
type Err = ParseHeaderValueError;
266248

@@ -297,7 +279,7 @@ impl HeaderValue {
297279
}
298280

299281
pub fn as_str(&self) -> &str {
300-
self.into()
282+
self.inner.as_str()
301283
}
302284
}
303285

@@ -614,10 +596,10 @@ mod tests {
614596

615597
assert_eq!(headers.get("Key").unwrap().to_string(), "value");
616598

617-
let key: String = headers.get("Key").unwrap().into();
599+
let key: String = headers.get("Key").unwrap().as_str().into();
618600
assert_eq!(key, "value".to_string());
619601

620-
let key: String = headers.get("Key").unwrap().to_owned().into();
602+
let key: String = headers.get("Key").unwrap().as_str().to_owned();
621603
assert_eq!(key, "value".to_string());
622604

623605
assert_eq!(headers.get("Key").unwrap().as_str(), "value");

0 commit comments

Comments
 (0)