Skip to content

Commit

Permalink
reduce unwraps from ToDname
Browse files Browse the repository at this point in the history
  • Loading branch information
tertsdiepraam committed Apr 3, 2024
1 parent b5d259d commit e55fd49
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/resolv/lookup/srv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion src/tsig/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ where
algorithm: Algorithm,
) -> Option<Self::Key> {
// 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()
}
}
Expand Down

0 comments on commit e55fd49

Please sign in to comment.