Skip to content

Commit

Permalink
Display NSEC3 without trailing space if the bitmap is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
ximon18 committed Nov 4, 2024
1 parent 70e998a commit 9268dd3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/rdata/dnssec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2169,6 +2169,11 @@ impl<Octs: AsRef<[u8]>> RtypeBitmap<Octs> {
) -> Result<(), Target::AppendError> {
target.append_slice(self.0.as_ref())
}

#[must_use]
pub fn is_empty(&self) -> bool {
self.iter().next().is_none()
}
}

//--- AsRef
Expand Down
5 changes: 4 additions & 1 deletion src/rdata/nsec3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,10 @@ impl<Octs: AsRef<[u8]>> fmt::Display for Nsec3<Octs> {
self.hash_algorithm, self.flags, self.iterations, self.salt
)?;
base32::display_hex(&self.next_owner, f)?;
write!(f, " {}", self.types)
if !self.types.is_empty() {
write!(f, " {}", self.types)?;
}
Ok(())
}
}

Expand Down

0 comments on commit 9268dd3

Please sign in to comment.