From c16b12d638f7a9c87d1681a05be18c2004fcb06c Mon Sep 17 00:00:00 2001 From: Patrick Siegl <3261314+psiegl@users.noreply.github.com> Date: Mon, 25 Nov 2024 16:23:48 +0100 Subject: [PATCH] Fix linter --- commons/zenoh-config/src/wrappers.rs | 4 ++-- zenoh/src/net/runtime/orchestrator.rs | 32 ++++++++++++++++++--------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/commons/zenoh-config/src/wrappers.rs b/commons/zenoh-config/src/wrappers.rs index 827ca659e..e81712867 100644 --- a/commons/zenoh-config/src/wrappers.rs +++ b/commons/zenoh-config/src/wrappers.rs @@ -20,8 +20,8 @@ use std::str::FromStr; use serde::{Deserialize, Serialize}; use zenoh_protocol::{ - core::{key_expr::OwnedKeyExpr, EntityGlobalIdProto, EndPoint, WhatAmI, ZenohIdProto}, - scouting::hello::HelloEndPoint + core::{key_expr::OwnedKeyExpr, EndPoint, EntityGlobalIdProto, WhatAmI, ZenohIdProto}, + scouting::hello::HelloEndPoint, }; /// The global unique id of a Zenoh session. diff --git a/zenoh/src/net/runtime/orchestrator.rs b/zenoh/src/net/runtime/orchestrator.rs index 489009b39..75b2dcd42 100644 --- a/zenoh/src/net/runtime/orchestrator.rs +++ b/zenoh/src/net/runtime/orchestrator.rs @@ -35,7 +35,7 @@ use zenoh_config::{ use zenoh_link::{Locator, LocatorInspector}; use zenoh_protocol::{ core::{whatami::WhatAmIMatcher, EndPoint, Metadata, PriorityRange, WhatAmI, ZenohIdProto}, - scouting::{HelloProto, Scout, ScoutingBody, ScoutingMessage, hello::HelloEndPoint}, + scouting::{hello::HelloEndPoint, HelloProto, Scout, ScoutingBody, ScoutingMessage}, }; use zenoh_result::{bail, zerror, ZResult}; @@ -899,17 +899,27 @@ impl Runtime { if let ScoutingBody::Hello(hello) = &msg.body { if matcher.matches(hello.whatami) { if let Ok(local_addr) = socket.local_addr() { - if let Ok(iface) = zenoh_util::net::get_interface_names_by_addr(local_addr.ip()) { + if let Ok(iface) = + zenoh_util::net::get_interface_names_by_addr( + local_addr.ip() + ) + { let endpoint = HelloEndPoint { version: hello.version, whatami: hello.whatami, zid: hello.zid, - endpoints: hello.locators + endpoints: hello + .locators .iter() - .map(|locator| EndPoint::new(locator.protocol(), - locator.address(), - locator.metadata(), - "iface=".to_string() + &iface[0]).unwrap()) + .map(|locator| + EndPoint::new( + locator.protocol(), + locator.address(), + locator.metadata(), + "iface=".to_string() + &iface[0], + ) + .unwrap() + ) .collect() }; if let Loop::Break = f(endpoint.clone()).await { @@ -921,10 +931,11 @@ impl Runtime { version: hello.version, whatami: hello.whatami, zid: hello.zid, - endpoints: hello.locators + endpoints: hello + .locators .iter() .map(|locator| locator.to_endpoint()) - .collect() + .collect(), }; if let Loop::Break = f(endpoint.clone()).await { break; @@ -1105,7 +1116,8 @@ impl Runtime { } pub async fn connect_peer(&self, zid: &ZenohIdProto, locators: &[Locator]) -> bool { - let endpoints: Vec = locators.iter() + let endpoints: Vec = locators + .iter() .map(|locator| locator.to_endpoint().clone()) .collect(); self.connect_endpoints(zid, &endpoints).await