Skip to content

Commit 77b097e

Browse files
committed
Update to wasi 0.14.0, eliminating .to_owned() calls.
1 parent 9441f82 commit 77b097e

File tree

4 files changed

+4
-10
lines changed

4 files changed

+4
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ test-log = { version = "0.2", features = ["trace"] }
6464
test-programs = { path = "test-programs" }
6565
test-programs-artifacts = { path = "test-programs/artifacts" }
6666
ureq = "2.12.1"
67-
wasi = "0.13.1"
67+
wasi = "0.14.0"
6868
wasmtime = "26"
6969
wasmtime-cli = "26"
7070
wasmtime-wasi = "26"

src/http/fields.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ pub(crate) fn header_map_to_wasi(header_map: &HeaderMap) -> Fields {
2222
let wasi_fields = Fields::new();
2323
for (key, value) in header_map {
2424
// Unwrap because `HeaderMap` has already validated the headers.
25-
// TODO: Remove the `to_owned()` calls after bytecodealliance/wit-bindgen#1102.
2625
wasi_fields
27-
.append(&key.as_str().to_owned(), &value.as_bytes().to_owned())
26+
.append(&key.as_str(), &value.as_bytes())
2827
.unwrap_or_else(|err| panic!("header named {key}: {err:?}"));
2928
}
3029
wasi_fields

src/http/request.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,8 @@ pub(crate) fn try_into_outgoing<T>(request: Request<T>) -> Result<(OutgoingReque
4141

4242
// Set the url path + query string
4343
if let Some(p_and_q) = parts.uri.path_and_query() {
44-
// TODO: Change the `to_string()` to `as_str()` after bytecodealliance/wit-bindgen#1102.
4544
wasi_req
46-
.set_path_with_query(Some(&p_and_q.to_string()))
45+
.set_path_with_query(Some(&p_and_q.as_str()))
4746
.map_err(|()| {
4847
Error::other(format!("path and query rejected by wasi-http {p_and_q:?}"))
4948
})?;

src/http/server.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,9 @@ impl Responder {
107107

108108
// Automatically add a Content-Length header.
109109
if let Some(len) = body.len() {
110-
// TODO: Remove the `to_owned()` calls after bytecodealliance/wit-bindgen#1102.
111110
let mut buffer = itoa::Buffer::new();
112111
wasi_headers
113-
.append(
114-
&CONTENT_LENGTH.as_str().to_owned(),
115-
&buffer.format(len).to_owned().into_bytes(),
116-
)
112+
.append(&CONTENT_LENGTH.as_str(), &buffer.format(len).as_bytes())
117113
.unwrap();
118114
}
119115

0 commit comments

Comments
 (0)