@@ -4,6 +4,7 @@ use super::Error;
44///
55/// All "EXPERIMENTAL" markers here are from the RFC
66#[ derive( Debug , PartialEq , Eq , Clone , Copy , Hash ) ]
7+ #[ allow( clippy:: upper_case_acronyms) ]
78pub enum Type {
89 /// a host addresss
910 A = 1 ,
@@ -55,6 +56,7 @@ pub enum Type {
5556///
5657/// All "EXPERIMENTAL" markers here are from the RFC
5758#[ derive( Debug , PartialEq , Eq , Clone , Copy , Hash ) ]
59+ #[ allow( clippy:: upper_case_acronyms) ]
5860pub enum QueryType {
5961 /// a host addresss
6062 A = 1 ,
@@ -153,7 +155,7 @@ pub enum ResponseCode {
153155
154156impl From < u16 > for Opcode {
155157 fn from ( code : u16 ) -> Opcode {
156- use self :: Opcode :: * ;
158+ use self :: Opcode :: { InverseQuery , Reserved , ServerStatusRequest , StandardQuery } ;
157159 match code {
158160 0 => StandardQuery ,
159161 1 => InverseQuery ,
@@ -162,10 +164,10 @@ impl From<u16> for Opcode {
162164 }
163165 }
164166}
165- impl Into < u16 > for Opcode {
166- fn into ( self ) -> u16 {
167- use self :: Opcode :: * ;
168- match self {
167+ impl From < Opcode > for u16 {
168+ fn from ( val : Opcode ) -> Self {
169+ use self :: Opcode :: { InverseQuery , Reserved , ServerStatusRequest , StandardQuery } ;
170+ match val {
169171 StandardQuery => 0 ,
170172 InverseQuery => 1 ,
171173 ServerStatusRequest => 2 ,
@@ -176,7 +178,9 @@ impl Into<u16> for Opcode {
176178
177179impl From < u8 > for ResponseCode {
178180 fn from ( code : u8 ) -> ResponseCode {
179- use self :: ResponseCode :: * ;
181+ use self :: ResponseCode :: {
182+ FormatError , NameError , NoError , NotImplemented , Refused , Reserved , ServerFailure ,
183+ } ;
180184 match code {
181185 0 => NoError ,
182186 1 => FormatError ,
@@ -189,10 +193,12 @@ impl From<u8> for ResponseCode {
189193 }
190194 }
191195}
192- impl Into < u8 > for ResponseCode {
193- fn into ( self ) -> u8 {
194- use self :: ResponseCode :: * ;
195- match self {
196+ impl From < ResponseCode > for u8 {
197+ fn from ( val : ResponseCode ) -> Self {
198+ use self :: ResponseCode :: {
199+ FormatError , NameError , NoError , NotImplemented , Refused , Reserved , ServerFailure ,
200+ } ;
201+ match val {
196202 NoError => 0 ,
197203 FormatError => 1 ,
198204 ServerFailure => 2 ,
@@ -206,7 +212,10 @@ impl Into<u8> for ResponseCode {
206212
207213impl QueryType {
208214 pub fn parse ( code : u16 ) -> Result < QueryType , Error > {
209- use self :: QueryType :: * ;
215+ use self :: QueryType :: {
216+ All , A , AAAA , AXFR , CNAME , HINFO , MAILA , MAILB , MB , MF , MG , MINFO , MR , MX , NS , NULL ,
217+ PTR , SOA , SRV , TXT , WKS ,
218+ } ;
210219 match code {
211220 1 => Ok ( A ) ,
212221 2 => Ok ( NS ) ,
@@ -236,7 +245,7 @@ impl QueryType {
236245
237246impl QueryClass {
238247 pub fn parse ( code : u16 ) -> Result < QueryClass , Error > {
239- use self :: QueryClass :: * ;
248+ use self :: QueryClass :: { Any , CH , CS , HS , IN } ;
240249 match code {
241250 1 => Ok ( IN ) ,
242251 2 => Ok ( CS ) ,
@@ -250,7 +259,10 @@ impl QueryClass {
250259
251260impl Type {
252261 pub fn parse ( code : u16 ) -> Result < Type , Error > {
253- use self :: Type :: * ;
262+ use self :: Type :: {
263+ A , AAAA , CNAME , DNSKEY , DS , HINFO , MB , MF , MG , MINFO , MR , MX , NS , NSEC , NULL , OPT , PTR ,
264+ RRSIG , SOA , SRV , TXT , WKS ,
265+ } ;
254266 match code {
255267 1 => Ok ( A ) ,
256268 2 => Ok ( NS ) ,
@@ -281,7 +293,7 @@ impl Type {
281293
282294impl Class {
283295 pub fn parse ( code : u16 ) -> Result < Class , Error > {
284- use self :: Class :: * ;
296+ use self :: Class :: { CH , CS , HS , IN } ;
285297 match code {
286298 1 => Ok ( IN ) ,
287299 2 => Ok ( CS ) ,
0 commit comments