From cbdfdfacc1526666c51c334b94ffc48abafb440c Mon Sep 17 00:00:00 2001 From: Luna Yao <40349250+ZnqbuZ@users.noreply.github.com> Date: Fri, 17 Apr 2026 18:55:13 +0200 Subject: [PATCH] use cfg_select in dns::system::get --- easytier/src/dns/system/mod.rs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/easytier/src/dns/system/mod.rs b/easytier/src/dns/system/mod.rs index 0fe892b4..245ae6af 100644 --- a/easytier/src/dns/system/mod.rs +++ b/easytier/src/dns/system/mod.rs @@ -26,18 +26,17 @@ pub trait SystemConfigurator: Send + Sync { pub fn get( #[allow(unused_variables)] interface: &str, ) -> Result>, anyhow::Error> { - #[cfg(target_os = "windows")] - { - use crate::dns::system::windows::WindowsDNSManager; - return Ok(Some(WindowsDNSManager::new(interface)?.boxed())); - } + cfg_select! { + target_os = "windows" => { + use crate::dns::system::windows::WindowsDNSManager; + Ok(Some(WindowsDNSManager::new(interface)?.boxed())) + } - #[cfg(all(target_os = "macos", not(feature = "macos-ne")))] - { - use crate::dns::system::macos::DarwinConfigurator; - return Ok(Some(DarwinConfigurator::new().boxed())); - } + all(target_os = "macos", not(feature = "macos-ne")) => { + use crate::dns::system::macos::DarwinConfigurator; + Ok(Some(DarwinConfigurator::new().boxed())) + } - #[allow(unreachable_code)] - Ok(None) + _ => Ok(None) + } }