fixup cleanliness for typed record

This commit is contained in:
Benjamin Fry
2022-10-10 18:33:19 -07:00
parent cb2798a0cd
commit d3823cde0c
2 changed files with 3 additions and 9 deletions

View File

@@ -229,10 +229,10 @@ impl RecordData for SOA {
decoder: &mut BinDecoder<'_>,
record_type: RecordType,
_length: Restrict<u16>,
) -> ProtoResult<SOA> {
) -> ProtoResult<Self> {
assert_eq!(RecordType::SOA, record_type);
Ok(SOA {
Ok(Self {
mname: Name::read(decoder)?,
rname: Name::read(decoder)?,
serial: decoder.read_u32()?.unverified(/*any u32 is valid*/),

View File

@@ -197,7 +197,7 @@ impl<R: RecordData> Record<R> {
/// Converts this Record into a generic version of RData
pub fn into_record_of_rdata(self) -> Record<RData> {
let Record {
let Self {
name_labels,
rr_type,
dns_class,
@@ -277,13 +277,7 @@ impl<R: RecordData> Record<R> {
/// For example, the if the TYPE is A and the CLASS is IN,
/// the RDATA field is a 4 octet ARPA Internet address.
/// ```
#[allow(deprecated)]
pub fn set_data(&mut self, rdata: Option<R>) -> &mut Self {
// debug_assert!(
// !(matches!(&rdata, Some(RData::ZERO))
// && matches!(&rdata, Some(RData::NULL(null)) if null.anything().is_empty())),
// "pass None rather than ZERO or NULL"
// );
self.rdata = rdata;
self
}