diff --git a/commons/zenoh-config/src/lib.rs b/commons/zenoh-config/src/lib.rs index ac6f59af89..cd93291eb0 100644 --- a/commons/zenoh-config/src/lib.rs +++ b/commons/zenoh-config/src/lib.rs @@ -22,10 +22,9 @@ use std::convert::TryFrom; // This is a false positive from the rust analyser use std::{ any::Any, collections::HashSet, - fmt, + fmt::{self, Display}, io::Read, net::SocketAddr, - ops::DerefMut, path::Path, sync::{Arc, Mutex, MutexGuard, Weak}, }; @@ -265,8 +264,8 @@ impl std::ops::Deref for Config { } #[zenoh_macros::internal] -impl DerefMut for Config { - fn deref_mut(&mut self) -> &mut ::Target { +impl std::ops::DerefMut for Config { + fn deref_mut(&mut self) -> &mut ::Target { &mut self.0 } } @@ -278,6 +277,12 @@ impl From for InternalConfig { } } +impl Display for Config { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", &self.0) + } +} + validated_struct::validator! { #[derive(Default)] #[recursive_attrs] diff --git a/zenohd/src/main.rs b/zenohd/src/main.rs index 94ee3a47fa..3f860c151e 100644 --- a/zenohd/src/main.rs +++ b/zenohd/src/main.rs @@ -19,7 +19,7 @@ use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt, EnvFilte use url::Url; use zenoh::{ config::{EndPoint, InternalConfig, ModeDependentValue, PermissionsConf, WhatAmI}, - Result, + Config, Result, }; use zenoh_util::LibSearchDirs; @@ -115,12 +115,12 @@ fn main() { }); } -fn config_from_args(args: &Args) -> InternalConfig { +fn config_from_args(args: &Args) -> Config { let mut config = args .config .as_ref() - .map_or_else(InternalConfig::default, |conf_file| { - InternalConfig::from_file(conf_file).unwrap() + .map_or_else(Config::default, |conf_file| { + Config::from_file(conf_file).unwrap() }); if config.mode().is_none() {