Skip to content

Commit 1ca35fb

Browse files
committed
Fix formatting and clippy warning in tcp_rerouting example
- Remove trailing whitespace - Use next_back() instead of last() for better performance
1 parent 2a76dcf commit 1ca35fb

File tree

1 file changed

+4
-4
lines changed
  • examples/tcp_rerouting/src

1 file changed

+4
-4
lines changed

examples/tcp_rerouting/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ impl StreamContext for TcpReroutingStream {
106106
// Use the Envoy-specific filter state mechanism
107107
// https://github.com/envoyproxy/envoy/issues/28128
108108
let status = self.call_foreign_function("set_envoy_filter_state", Some(&buf));
109-
109+
110110
info!(
111111
"[TCP WASM] set_envoy_filter_state status (envoy.tcp_proxy.cluster): {:?}",
112112
status
@@ -129,10 +129,10 @@ impl StreamContext for TcpReroutingStream {
129129
fn extract_last_octet(addr: &str) -> Option<u8> {
130130
// Remove port if present (format: "ip:port")
131131
let ip_part = addr.split(':').next()?;
132-
132+
133133
// Split by '.' and get the last segment
134-
let last_segment = ip_part.split('.').last()?;
135-
134+
let last_segment = ip_part.split('.').next_back()?;
135+
136136
// Parse as u8
137137
last_segment.parse::<u8>().ok()
138138
}

0 commit comments

Comments
 (0)