diff --git a/Cargo.lock b/Cargo.lock index da4d0b6c8f06..755a11ae9dc2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -152,9 +152,9 @@ checksum = "d7a1e2f27636f116493b8b860f5546edb47c8d8f8ea73e1d2a20be88e28d1fea" [[package]] name = "deranged" -version = "0.3.11" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" dependencies = [ "powerfmt", ] @@ -734,9 +734,9 @@ dependencies = [ [[package]] name = "num-conv" -version = "0.1.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" +checksum = "c6673768db2d862beb9b39a78fdcb1a69439615d5794a1be50caa9bc92c81967" [[package]] name = "once_cell" @@ -1171,22 +1171,22 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" dependencies = [ "deranged", "num-conv", "powerfmt", - "serde", + "serde_core", "time-core", ] [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" [[package]] name = "tinystr" diff --git a/bazel/dependency_imports.bzl b/bazel/dependency_imports.bzl index ed6a211285f1..f0054547d8e2 100644 --- a/bazel/dependency_imports.bzl +++ b/bazel/dependency_imports.bzl @@ -65,7 +65,7 @@ def envoy_dependency_imports( ) rules_rust_dependencies() rust_register_toolchains( - versions = ["1.86.0"], + versions = ["1.88.0"], extra_target_triples = [ "wasm32-unknown-unknown", "wasm32-wasi", diff --git a/source/extensions/dynamic_modules/builtin_extensions/Cargo.toml b/source/extensions/dynamic_modules/builtin_extensions/Cargo.toml index 24be54f8e6f3..a07e8b7a9079 100644 --- a/source/extensions/dynamic_modules/builtin_extensions/Cargo.toml +++ b/source/extensions/dynamic_modules/builtin_extensions/Cargo.toml @@ -12,12 +12,10 @@ envoy-proxy-dynamic-modules-rust-sdk = { path = "../sdk/rust" } hickory-resolver = { version = "0.25", features = ["system-config", "tokio", "tls-ring", "https-ring", "dnssec-ring", "webpki-roots"] } serde = { version = "1", features = ["derive"] } serde_json = "1" +time = ">=0.3.47" tokio = { version = "1", features = ["rt-multi-thread", "macros"] } url = "2" -# Pin time to a version compatible with stable Rust. -time = ">=0.3.0, <0.3.37" - [lib] name = "envoy_dynamic_modules_builtin_extensions" path = "lib.rs" diff --git a/test/extensions/dynamic_modules/test_data/rust/bootstrap_admin_handler_test.rs b/test/extensions/dynamic_modules/test_data/rust/bootstrap_admin_handler_test.rs index 9e2e6964cda8..663192fe4c31 100644 --- a/test/extensions/dynamic_modules/test_data/rust/bootstrap_admin_handler_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/bootstrap_admin_handler_test.rs @@ -53,10 +53,7 @@ impl BootstrapExtensionConfig for AdminHandlerTestBootstrapExtensionConfig { envoy_log_info!("Admin request received: {} {}", method, path); ( 200, - format!( - "Hello from dynamic module admin handler! method={} path={}", - method, path - ), + format!("Hello from dynamic module admin handler! method={method} path={path}"), ) } } diff --git a/test/extensions/dynamic_modules/test_data/rust/bootstrap_http_combined_test.rs b/test/extensions/dynamic_modules/test_data/rust/bootstrap_http_combined_test.rs index d4ea85287159..f9ad25c63d06 100644 --- a/test/extensions/dynamic_modules/test_data/rust/bootstrap_http_combined_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/bootstrap_http_combined_test.rs @@ -242,7 +242,7 @@ impl HttpFilter for CombinedHttpFilter { envoy_filter.send_response( 503, &[("x-error-reason", b"service_not_onboarded")], - Some(format!("service '{}' is not onboarded", svc).as_bytes()), + Some(format!("service '{svc}' is not onboarded").as_bytes()), Some("service_not_onboarded"), ); abi::envoy_dynamic_module_type_on_http_filter_request_headers_status::StopIteration diff --git a/test/extensions/dynamic_modules/test_data/rust/bootstrap_timer_test.rs b/test/extensions/dynamic_modules/test_data/rust/bootstrap_timer_test.rs index e8e06b803efe..2424b16527fd 100644 --- a/test/extensions/dynamic_modules/test_data/rust/bootstrap_timer_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/bootstrap_timer_test.rs @@ -105,7 +105,7 @@ impl BootstrapExtensionConfig for TimerTestBootstrapExtensionConfig { let mut guard = self.timer_b.lock().unwrap(); *guard = None; } else { - panic!("Unknown timer fired with id: {}", fired_id); + panic!("Unknown timer fired with id: {fired_id}"); } // Signal init complete and log success once both timers have fired. diff --git a/test/extensions/dynamic_modules/test_data/rust/http.rs b/test/extensions/dynamic_modules/test_data/rust/http.rs index a37dbebe8a92..ad889e510c0d 100644 --- a/test/extensions/dynamic_modules/test_data/rust/http.rs +++ b/test/extensions/dynamic_modules/test_data/rust/http.rs @@ -49,7 +49,7 @@ fn new_http_filter_config_fn( "typed_filter_state_callbacks" => Some(Box::new(TypedFilterStateCallbacksFilterConfig {})), "body_callbacks" => Some(Box::new(BodyCallbacksFilterConfig {})), "config_init_failure" => None, - _ => panic!("Unknown filter name: {}", name), + _ => panic!("Unknown filter name: {name}"), } } @@ -1065,29 +1065,17 @@ impl std::io::Write for BodyWriter<'_, EHF> { if self.request { if self.received { if !self.envoy_filter.append_received_request_body(buf) { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Buffer is not available", - )); + return Err(std::io::Error::other("Buffer is not available")); } } else if !self.envoy_filter.append_buffered_request_body(buf) { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Buffer is not available", - )); + return Err(std::io::Error::other("Buffer is not available")); } } else if self.received { if !self.envoy_filter.append_received_response_body(buf) { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Buffer is not available", - )); + return Err(std::io::Error::other("Buffer is not available")); } } else if !self.envoy_filter.append_buffered_response_body(buf) { - return Err(std::io::Error::new( - std::io::ErrorKind::Other, - "Buffer is not available", - )); + return Err(std::io::Error::other("Buffer is not available")); } Ok(buf.len()) diff --git a/test/extensions/dynamic_modules/test_data/rust/http_integration_test.rs b/test/extensions/dynamic_modules/test_data/rust/http_integration_test.rs index f793c3a1c819..a97caca92c16 100644 --- a/test/extensions/dynamic_modules/test_data/rust/http_integration_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/http_integration_test.rs @@ -136,7 +136,7 @@ fn new_http_filter_config_fn( Some(Box::new(ConfigStreamConfig { stream_done })) }, "list_metadata_callbacks" => Some(Box::new(ListMetadataCallbacksFilterConfig {})), - _ => panic!("Unknown filter name: {}", name), + _ => panic!("Unknown filter name: {name}"), } } @@ -145,7 +145,7 @@ fn new_http_filter_per_route_config_fn(name: &str, config: &[u8]) -> Option Some(Box::new(PerRoutePerRouteFilterConfig { value: String::from_utf8(config.to_owned()).unwrap(), })), - _ => panic!("Unknown filter name: {}", name), + _ => panic!("Unknown filter name: {name}"), } } @@ -787,7 +787,7 @@ impl SendResponseHttpFilterConfig { b"on_request_headers" => SendResponseHttpFilter::RequestHeader, b"on_request_body" => SendResponseHttpFilter::RequestBody, b"on_response_headers" => SendResponseHttpFilter::ResponseHeader, - _ => panic!("Unknown filter name: {:?}", config), + _ => panic!("Unknown filter name: {config:?}"), }; Self { f } } @@ -1895,7 +1895,7 @@ impl HttpFilter for ListMetadataCallbacksFilter { let val = envoy_filter .get_metadata_list_number(source, "ns", "numbers", i) .unwrap(); - let header_name = format!("x-list-num-{}", i); + let header_name = format!("x-list-num-{i}"); envoy_filter.set_response_header(&header_name, (val as i64).to_string().as_bytes()); } @@ -1909,7 +1909,7 @@ impl HttpFilter for ListMetadataCallbacksFilter { .get_metadata_list_string(source, "ns", "strings", i) .unwrap(); let val_bytes = val.as_slice().to_vec(); - let header_name = format!("x-list-str-{}", i); + let header_name = format!("x-list-str-{i}"); envoy_filter.set_response_header(&header_name, &val_bytes); } @@ -1922,7 +1922,7 @@ impl HttpFilter for ListMetadataCallbacksFilter { let val = envoy_filter .get_metadata_list_bool(source, "ns", "bools", i) .unwrap(); - let header_name = format!("x-list-bool-{}", i); + let header_name = format!("x-list-bool-{i}"); envoy_filter.set_response_header(&header_name, val.to_string().as_bytes()); } diff --git a/test/extensions/dynamic_modules/test_data/rust/http_stream_callouts_test.rs b/test/extensions/dynamic_modules/test_data/rust/http_stream_callouts_test.rs index 080c64ee5277..9fface8c5cf9 100644 --- a/test/extensions/dynamic_modules/test_data/rust/http_stream_callouts_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/http_stream_callouts_test.rs @@ -32,7 +32,7 @@ fn new_http_filter_config_fn( "upstream_reset" => Some(Box::new(UpstreamResetConfig { cluster_name: String::from_utf8(config.to_owned()).unwrap(), })), - _ => panic!("Unknown filter name: {}", name), + _ => panic!("Unknown filter name: {name}"), } } @@ -263,7 +263,7 @@ impl HttpFilter for MultipleStreamsFilter { ) -> envoy_dynamic_module_type_on_http_filter_request_headers_status { // Create 3 concurrent streams. for i in 1..=3 { - let path = format!("/stream{}", i); + let path = format!("/stream{i}"); let (result, handle) = envoy_filter.start_http_stream( &self.cluster_name, &[ diff --git a/test/extensions/dynamic_modules/test_data/rust/network_integration_test.rs b/test/extensions/dynamic_modules/test_data/rust/network_integration_test.rs index a118bb24fb0a..50f1afbe597c 100644 --- a/test/extensions/dynamic_modules/test_data/rust/network_integration_test.rs +++ b/test/extensions/dynamic_modules/test_data/rust/network_integration_test.rs @@ -20,7 +20,7 @@ fn new_network_filter_config_fn Some(Box::new(ConnectionStateFilterConfig)), "half_close" => Some(Box::new(HalfCloseFilterConfig)), "buffer_limits" => Some(Box::new(BufferLimitsFilterConfig)), - _ => panic!("unknown filter name: {}", name), + _ => panic!("unknown filter name: {name}"), } } diff --git a/test/extensions/dynamic_modules/test_data/rust/upstream_http_tcp_bridge.rs b/test/extensions/dynamic_modules/test_data/rust/upstream_http_tcp_bridge.rs index 1497932cb3fe..02fd04dc480f 100644 --- a/test/extensions/dynamic_modules/test_data/rust/upstream_http_tcp_bridge.rs +++ b/test/extensions/dynamic_modules/test_data/rust/upstream_http_tcp_bridge.rs @@ -52,7 +52,7 @@ impl UpstreamHttpTcpBridge for TestBridge { BridgeMode::Streaming => { if let (Some(method), _) = envoy_bridge.get_request_header_value(":method", 0) { let method_str = std::str::from_utf8(&method).unwrap_or("?"); - let prefix = format!("METHOD={} ", method_str); + let prefix = format!("METHOD={method_str} "); envoy_bridge.send_upstream_data(prefix.as_bytes(), false); } },