Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit 1f9e299

Browse files
committed
Shift away from using std::str::from_utf8.
(It's probably being removed, see rust-lang/rust#10701.)
1 parent bc47859 commit 1f9e299

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/examples/client/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ fn make_and_print_request(url: ~str) {
4747
println!(" - {}: {}", header.header_name(), header.header_value());
4848
}
4949
println("Body:");
50-
println(str::from_utf8(response.read_to_end()));
50+
let body = response.read_to_end();
51+
println(str::from_utf8_slice(body));
5152
}

src/http/headers/test_utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn from_stream_with_str<T: HeaderConvertible>(s: &str) -> Option<T> {
1414
pub fn to_stream_into_str<T: HeaderConvertible>(v: &T) -> ~str {
1515
let mut writer = MemWriter::new();
1616
v.to_stream(&mut writer);
17-
str::from_utf8(writer.inner_ref().as_slice())
17+
str::from_utf8_owned(writer.inner_ref().to_owned())
1818
}
1919

2020
// Verify that a value cannot be successfully interpreted as a header value of the specified type.

0 commit comments

Comments
 (0)