Skip to content

Commit

Permalink
Update to Rust 1.54.0
Browse files Browse the repository at this point in the history
  • Loading branch information
XAMPPRocky committed Aug 5, 2021
1 parent ddb2236 commit 8cb38b3
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 42 deletions.
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@
# limitations under the License.

[toolchain]
channel = "1.51.0"
channel = "1.54.0"
components = ["rustfmt", "clippy"]
6 changes: 3 additions & 3 deletions src/filters/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl FilterChain {
)
.const_label(FILTER_LABEL, name),
)
.and_then(|histogram| histogram.register_if_not_exists(&registry))
.and_then(|histogram| histogram.register_if_not_exists(registry))
})
.collect::<Result<_, prometheus::Error>>()?,
filter_write_duration_seconds: filters
Expand All @@ -80,7 +80,7 @@ impl FilterChain {
)
.const_label(FILTER_LABEL, name),
)
.and_then(|histogram| histogram.register_if_not_exists(&registry))
.and_then(|histogram| histogram.register_if_not_exists(registry))
})
.collect::<Result<_, prometheus::Error>>()?,
filters,
Expand Down Expand Up @@ -112,7 +112,7 @@ impl FilterChain {
}
}

FilterChain::new(filters, &metrics_registry)
FilterChain::new(filters, metrics_registry)
}
}

Expand Down
31 changes: 9 additions & 22 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,28 +26,15 @@ pub(crate) mod xds;

pub use quilkin_macros::include_proto;

/// Run tests in our external documentation. This is only available in
/// nightly at the moment, but is stable on nightly and will be available in
/// 1.54.0. To run them locally run e.g `cargo +nightly test --doc`.
#[cfg(doctest)]
mod external_doc_tests {
// HACK(XAMPPRocky): This is hidden inside a macro, because the right hand
// side of `include_str!` is parsed before the `cfg` predicate currently.
// https://github.com/rust-lang/rust/issues/85882
macro_rules! hide {
() => {
#[doc = include_str!("../docs/extensions/filters/filters.md")]
#[doc = include_str!("../docs/extensions/filters/writing_custom_filters.md")]
#[doc = include_str!("../docs/extensions/filters/load_balancer.md")]
#[doc = include_str!("../docs/extensions/filters/local_rate_limit.md")]
#[doc = include_str!("../docs/extensions/filters/debug.md")]
#[doc = include_str!("../docs/extensions/filters/concatenate_bytes.md")]
#[doc = include_str!("../docs/extensions/filters/capture_bytes.md")]
#[doc = include_str!("../docs/extensions/filters/token_router.md")]
#[doc = include_str!("../docs/extensions/filters/compress.md")]
mod tests {}
};
}

hide!();
#![doc = include_str!("../docs/extensions/filters/filters.md")]
#![doc = include_str!("../docs/extensions/filters/writing_custom_filters.md")]
#![doc = include_str!("../docs/extensions/filters/load_balancer.md")]
#![doc = include_str!("../docs/extensions/filters/local_rate_limit.md")]
#![doc = include_str!("../docs/extensions/filters/debug.md")]
#![doc = include_str!("../docs/extensions/filters/concatenate_bytes.md")]
#![doc = include_str!("../docs/extensions/filters/capture_bytes.md")]
#![doc = include_str!("../docs/extensions/filters/token_router.md")]
#![doc = include_str!("../docs/extensions/filters/compress.md")]
}
6 changes: 3 additions & 3 deletions src/proxy/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,10 @@ impl Server {
if let Some(response) = result {
for endpoint in response.endpoints.iter() {
Self::session_send_packet(
&response.contents.as_slice(),
&response.contents,
recv_addr,
endpoint,
&args,
args,
)
.await;
}
Expand Down Expand Up @@ -408,7 +408,7 @@ impl Server {
if let Some(session) = guard.get(&session_key) {
Self::session_send_packet_helper(
&args.log,
&session,
session,
packet,
args.session_ttl,
)
Expand Down
2 changes: 1 addition & 1 deletion src/proxy/sessions/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl Session {

trace!(log, "Received packet"; "from" => from,
"endpoint_addr" => &endpoint.address,
"contents" => debug::bytes_to_string(&packet));
"contents" => debug::bytes_to_string(packet));

if let Err(err) = Session::do_update_expiration(expiration, ttl) {
warn!(log, "Error updating session expiration"; "error" => %err)
Expand Down
10 changes: 5 additions & 5 deletions src/xds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
* limitations under the License.
*/

#[allow(clippy::module_inception)]
// We don't control the codegen, so disable any code warnings in the
// proto modules.
#[allow(warnings)]
mod xds {
pub mod core {
pub mod v3 {
Expand All @@ -24,6 +26,7 @@ mod xds {
}
}

#[allow(warnings)]
mod envoy {
pub mod r#type {
pub mod matcher {
Expand Down Expand Up @@ -64,7 +67,6 @@ mod envoy {
}
pub mod core {
pub mod v3 {
#![allow(clippy::large_enum_variant)]
#![doc(hidden)]
tonic::include_proto!("envoy.config.core.v3");
}
Expand All @@ -77,7 +79,6 @@ mod envoy {
}
pub mod listener {
pub mod v3 {
#![allow(clippy::large_enum_variant)]
#![doc(hidden)]
tonic::include_proto!("envoy.config.listener.v3");
}
Expand All @@ -92,21 +93,20 @@ mod envoy {
pub mod service {
pub mod discovery {
pub mod v3 {
#![allow(clippy::unit_arg)]
#![doc(hidden)]
tonic::include_proto!("envoy.service.discovery.v3");
}
}
pub mod cluster {
pub mod v3 {
#![allow(clippy::unit_arg)]
#![doc(hidden)]
tonic::include_proto!("envoy.service.cluster.v3");
}
}
}
}

#[allow(warnings)]
mod google {
pub mod rpc {
#![doc(hidden)]
Expand Down
12 changes: 6 additions & 6 deletions src/xds/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,8 +692,8 @@ mod tests {
let cluster_a = cluster_state.get("a").unwrap();
let cluster_b = cluster_state.get("b").unwrap();

assert_cluster_has_lone_static_address(&cluster_a, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(&cluster_b, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(cluster_a, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(cluster_b, "127.0.0.1:2020");

// Update one of the clusters and check that the new cluster set is sent downstream.
cm.on_cluster_response(cluster_discovery_response_with_update(
Expand Down Expand Up @@ -730,8 +730,8 @@ mod tests {
let cluster_a = cluster_state.get("a").unwrap();
let cluster_b = cluster_state.get("b").unwrap();

assert_cluster_has_lone_static_address(&cluster_a, "127.0.0.10:3030");
assert_cluster_has_lone_static_address(&cluster_b, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(cluster_a, "127.0.0.10:3030");
assert_cluster_has_lone_static_address(cluster_b, "127.0.0.1:2020");
}

#[tokio::test]
Expand Down Expand Up @@ -786,8 +786,8 @@ mod tests {
let cluster_a = cluster_state.get("a").unwrap();
let cluster_b = cluster_state.get("b").unwrap();

assert_cluster_has_lone_static_address(&cluster_a, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(&cluster_b, "127.0.0.9:4040");
assert_cluster_has_lone_static_address(cluster_a, "127.0.0.1:2020");
assert_cluster_has_lone_static_address(cluster_b, "127.0.0.9:4040");
}

#[tokio::test]
Expand Down
5 changes: 4 additions & 1 deletion tests/xds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

#[allow(clippy::module_inception)]
#[allow(warnings)]
mod xds {
pub mod core {
pub mod v3 {
Expand All @@ -24,6 +24,7 @@ mod xds {
}
}

#[allow(warnings)]
mod envoy {
pub mod r#type {
pub mod matcher {
Expand Down Expand Up @@ -107,13 +108,15 @@ mod envoy {
}
}

#[allow(warnings)]
mod google {
pub mod rpc {
#![doc(hidden)]
tonic::include_proto!("google.rpc");
}
}

#[allow(warnings)]
mod quilkin_proto {
pub mod extensions {
pub mod filters {
Expand Down

0 comments on commit 8cb38b3

Please sign in to comment.