From e55fd492401279b1f5d9d6eeb2484385fe56de03 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Wed, 3 Apr 2024 12:10:45 +0200 Subject: [PATCH] reduce unwraps from ToDname --- src/resolv/lookup/srv.rs | 4 ++-- src/tsig/mod.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resolv/lookup/srv.rs b/src/resolv/lookup/srv.rs index d3b26e616..aee53b217 100644 --- a/src/resolv/lookup/srv.rs +++ b/src/resolv/lookup/srv.rs @@ -297,7 +297,7 @@ impl SrvItem { srv.priority(), srv.weight(), srv.port(), - srv.target().try_to_dname().unwrap(), + srv.target().to_dname(), ), fallback: false, resolved: None, @@ -306,7 +306,7 @@ impl SrvItem { fn fallback(name: impl ToDname, fallback_port: u16) -> Self { SrvItem { - srv: Srv::new(0, 0, fallback_port, name.try_to_dname().unwrap()), + srv: Srv::new(0, 0, fallback_port, name.to_dname()), fallback: true, resolved: None, } diff --git a/src/tsig/mod.rs b/src/tsig/mod.rs index c2acc8b0f..898ff4df7 100644 --- a/src/tsig/mod.rs +++ b/src/tsig/mod.rs @@ -391,7 +391,7 @@ where algorithm: Algorithm, ) -> Option { // XXX This seems a bit wasteful. - let name = name.try_to_dname().unwrap(); + let name = name.try_to_dname().ok()?; self.get(&(name, algorithm)).cloned() } }