Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(client): fix extra semi-colon warning in helper macro #2612

Merged
merged 2 commits into from
Aug 4, 2021
Merged
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
2 changes: 1 addition & 1 deletion capi/gen_header.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ cp "$CAPI_DIR/include/hyper.h" "$header_file_backup"
cd "${WORK_DIR}" || exit 2

# Expand just the ffi module
if ! output=$(RUSTFLAGS='--cfg hyper_unstable_ffi' cargo rustc -- -Z unstable-options --pretty=expanded 2>&1 > expanded.rs); then
if ! output=$(RUSTFLAGS='--cfg hyper_unstable_ffi' cargo rustc -- -Z unpretty=expanded 2>&1 > expanded.rs); then
# As of April 2021 the script above prints a lot of warnings/errors, and
# exits with a nonzero return code, but hyper.h still gets generated.
#
Expand Down
4 changes: 2 additions & 2 deletions tests/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,11 +344,11 @@ macro_rules! __client_req_prop {
}

macro_rules! __client_req_header {
($req_builder:ident, { $($name:expr => $val:expr,)* }) => {
($req_builder:ident, { $($name:expr => $val:expr,)* }) => {{
$(
$req_builder = $req_builder.header($name, $val);
)*
}
}}
}

static REPLY_OK: &str = "HTTP/1.1 200 OK\r\nContent-Length: 0\r\n\r\n";
Expand Down
16 changes: 8 additions & 8 deletions tests/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ macro_rules! __internal_eq_prop {
(headers: $map:tt) => {{
#[allow(unused_mut)]
{
let mut headers = Vec::new();
let mut headers = Vec::<std::sync::Arc<dyn Fn(&hyper::HeaderMap) + Send + Sync>>::new();
__internal_headers_eq!(headers, $map);
headers
}
Expand Down Expand Up @@ -216,12 +216,12 @@ macro_rules! __internal_headers_eq {
}
}) as std::sync::Arc<dyn Fn(&hyper::HeaderMap) + Send + Sync>
};
(@val $name: expr, NONE) => {
(@val $name: expr, NONE) => {{
__internal_headers_eq!(@pat $name, None);
};
(@val $name: expr, SOME) => {
__internal_headers_eq!(@pat $name, Some(_));
};
}};
(@val $name: expr, SOME) => {{
__internal_headers_eq!(@pat $name, Some(_))
}};
(@val $name: expr, $val:expr) => ({
let __val = Option::from($val);
std::sync::Arc::new(move |__hdrs: &hyper::HeaderMap| {
Expand All @@ -232,11 +232,11 @@ macro_rules! __internal_headers_eq {
}
}) as std::sync::Arc<dyn Fn(&hyper::HeaderMap) + Send + Sync>
});
($headers:ident, { $($name:expr => $val:tt,)* }) => {
($headers:ident, { $($name:expr => $val:tt,)* }) => {{
$(
$headers.push(__internal_headers_eq!(@val $name, $val));
)*
}
}}
}

#[derive(Clone, Debug)]
Expand Down