diff --git a/io/zenoh-links/zenoh-link-tcp/src/unicast.rs b/io/zenoh-links/zenoh-link-tcp/src/unicast.rs index 7532055f8e..ec2e6e06b7 100644 --- a/io/zenoh-links/zenoh-link-tcp/src/unicast.rs +++ b/io/zenoh-links/zenoh-link-tcp/src/unicast.rs @@ -348,7 +348,7 @@ impl LinkManagerUnicastTrait for LinkManagerUnicastTcp { // Update the endpoint locator address endpoint = EndPoint::new( endpoint.protocol(), - &format!("{local_addr}"), + format!("{local_addr}"), endpoint.metadata(), endpoint.config(), )?; diff --git a/io/zenoh-links/zenoh-link-vsock/src/unicast.rs b/io/zenoh-links/zenoh-link-vsock/src/unicast.rs index e7b261f292..979048b585 100644 --- a/io/zenoh-links/zenoh-link-vsock/src/unicast.rs +++ b/io/zenoh-links/zenoh-link-vsock/src/unicast.rs @@ -267,7 +267,7 @@ impl LinkManagerUnicastTrait for LinkManagerUnicastVsock { // Update the endpoint locator address endpoint = EndPoint::new( endpoint.protocol(), - &format!("{local_addr}"), + format!("{local_addr}"), endpoint.metadata(), endpoint.config(), )?; diff --git a/io/zenoh-transport/src/unicast/establishment/accept.rs b/io/zenoh-transport/src/unicast/establishment/accept.rs index 64949357c6..9d34896d95 100644 --- a/io/zenoh-transport/src/unicast/establishment/accept.rs +++ b/io/zenoh-transport/src/unicast/establishment/accept.rs @@ -211,11 +211,16 @@ impl<'a, 'b: 'a> AcceptFsm for &'a mut AcceptLink<'b> { }; // Compute the minimum batch size - state.transport.batch_size = state - .transport - .batch_size - .min(init_syn.batch_size) - .min(batch_size::UNICAST); + // Clippy raises a warning because `batch_size::UNICAST` is currently equal to `BatchSize::MAX`. + // However, the current code catches the cases where `batch_size::UNICAST` is different from `BatchSize::MAX`. + #[allow(clippy::unnecessary_min_or_max)] + { + state.transport.batch_size = state + .transport + .batch_size + .min(init_syn.batch_size) + .min(batch_size::UNICAST); + } // Extension QoS self.ext_qos @@ -684,10 +689,15 @@ pub(crate) async fn accept_link(link: LinkUnicast, manager: &TransportManager) - }; } + // Clippy raises a warning because `batch_size::UNICAST` is currently equal to `BatchSize::MAX`. + // However, the current code catches the cases where `batch_size::UNICAST` is different from `BatchSize::MAX`. + #[allow(clippy::unnecessary_min_or_max)] + let batch_size = manager.config.batch_size.min(batch_size::UNICAST).min(mtu); + let iack_out = { let mut state = State { transport: StateTransport { - batch_size: manager.config.batch_size.min(batch_size::UNICAST).min(mtu), + batch_size, resolution: manager.config.resolution, ext_qos: ext::qos::StateAccept::new(manager.config.unicast.is_qos), #[cfg(feature = "transport_multilink")] diff --git a/io/zenoh-transport/src/unicast/establishment/open.rs b/io/zenoh-transport/src/unicast/establishment/open.rs index a9e797228e..ff73e213c2 100644 --- a/io/zenoh-transport/src/unicast/establishment/open.rs +++ b/io/zenoh-transport/src/unicast/establishment/open.rs @@ -569,13 +569,18 @@ pub(crate) async fn open_link( ext_compression: ext::compression::CompressionFsm::new(), }; + // Clippy raises a warning because `batch_size::UNICAST` is currently equal to `BatchSize::MAX`. + // However, the current code catches the cases where `batch_size::UNICAST` is different from `BatchSize::MAX`. + #[allow(clippy::unnecessary_min_or_max)] + let batch_size = manager + .config + .batch_size + .min(link.config.batch.mtu) + .min(batch_size::UNICAST); + let mut state = State { transport: StateTransport { - batch_size: manager - .config - .batch_size - .min(batch_size::UNICAST) - .min(link.config.batch.mtu), + batch_size, resolution: manager.config.resolution, ext_qos: ext::qos::StateOpen::new(manager.config.unicast.is_qos), #[cfg(feature = "transport_multilink")]