From 298dd0f8b8b593681ef8d0d703a627e70c972916 Mon Sep 17 00:00:00 2001 From: joalopez1206 Date: Tue, 1 Oct 2024 17:57:00 -0300 Subject: [PATCH] change fmt --- src/message/rclass.rs | 17 +++++++------ src/message/rrtype.rs | 57 ++++++++++++++++++++++--------------------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/src/message/rclass.rs b/src/message/rclass.rs index f91c79cd..8d49a2ca 100644 --- a/src/message/rclass.rs +++ b/src/message/rclass.rs @@ -56,13 +56,14 @@ impl Default for Rclass { impl fmt::Display for Rclass { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", match *self { - Rclass::IN => "IN", - Rclass::CS => "CS", - Rclass::CH => "CH", - Rclass::HS => "HS", - Rclass::ANY => "ANY", - Rclass::UNKNOWN(_) => "UNKNOWN", - }) + let result = match *self { + Rclass::IN => "IN".to_string(), + Rclass::CS => "CS".to_string(), + Rclass::CH => "CH".to_string(), + Rclass::HS => "HS".to_string(), + Rclass::ANY => "ANY".to_string(), + Rclass::UNKNOWN(x) => x.to_string(), + }; + write!(f, "{}", result) } } \ No newline at end of file diff --git a/src/message/rrtype.rs b/src/message/rrtype.rs index febc8494..97764d2b 100644 --- a/src/message/rrtype.rs +++ b/src/message/rrtype.rs @@ -131,33 +131,34 @@ impl Default for Rrtype { } impl fmt::Display for Rrtype { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", match *self { - Rrtype::A => "A", - Rrtype::NS => "NS", - Rrtype::CNAME => "CNAME", - Rrtype::SOA => "SOA", - Rrtype::PTR => "PTR", - Rrtype::HINFO => "HINFO", - Rrtype::MINFO => "MINFO", - Rrtype::WKS => "WKS", - Rrtype::MX => "MX", - Rrtype::TXT => "TXT", - Rrtype::AAAA => "AAAA", - Rrtype::SRV => "SRV", - Rrtype::DNAME => "DNAME", - Rrtype::OPT => "OPT", - Rrtype::DS => "DS", - Rrtype::RRSIG => "RRSIG", - Rrtype::NSEC => "NSEC", - Rrtype::DNSKEY => "DNSKEY", - Rrtype::NSEC3 => "NSEC3", - Rrtype::NSEC3PARAM => "NSEC3PARAM", - Rrtype::TSIG => "TSIG", - Rrtype::AXFR => "AXFR", - Rrtype::MAILB => "MAILB", - Rrtype::MAILA => "MAILA", - Rrtype::ANY => "ANY", - Rrtype::UNKNOWN(_) => "UNKNOWN", - }) + let result = match *self { + Rrtype::A => "A".to_string(), + Rrtype::NS => "NS".to_string(), + Rrtype::CNAME => "CNAME".to_string(), + Rrtype::SOA => "SOA".to_string(), + Rrtype::PTR => "PTR".to_string(), + Rrtype::HINFO => "HINFO".to_string(), + Rrtype::MINFO => "MINFO".to_string(), + Rrtype::WKS => "WKS".to_string(), + Rrtype::MX => "MX".to_string(), + Rrtype::TXT => "TXT".to_string(), + Rrtype::AAAA => "AAAA".to_string(), + Rrtype::SRV => "SRV".to_string(), + Rrtype::DNAME => "DNAME".to_string(), + Rrtype::OPT => "OPT".to_string(), + Rrtype::DS => "DS".to_string(), + Rrtype::RRSIG => "RRSIG".to_string(), + Rrtype::NSEC => "NSEC".to_string(), + Rrtype::DNSKEY => "DNSKEY".to_string(), + Rrtype::NSEC3 => "NSEC3".to_string(), + Rrtype::NSEC3PARAM => "NSEC3PARAM".to_string(), + Rrtype::TSIG => "TSIG".to_string(), + Rrtype::AXFR => "AXFR".to_string(), + Rrtype::MAILB => "MAILB".to_string(), + Rrtype::MAILA => "MAILA".to_string(), + Rrtype::ANY => "ANY".to_string(), + Rrtype::UNKNOWN(x) => x.to_string(), + }; + write!(f, "{}", result) } } \ No newline at end of file