@@ -21,6 +21,7 @@ use openapiv3::{
2121 AdditionalProperties , IntegerFormat , ReferenceOr , Schema , SchemaKind , StringFormat , Type ,
2222 VariantOrUnknownOrEmpty ,
2323} ;
24+ use std:: fmt:: Display ;
2425
2526#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
2627pub struct ModelType {
@@ -42,19 +43,19 @@ pub enum IntFormat {
4243 I64 ,
4344}
4445
45- # [ allow ( clippy :: to_string_trait_impl ) ]
46- impl ToString for IntFormat {
47- fn to_string ( & self ) -> String {
48- match self {
49- IntFormat :: U8 => "u8" . to_string ( ) ,
50- IntFormat :: U16 => "u16" . to_string ( ) ,
51- IntFormat :: U32 => "u32" . to_string ( ) ,
52- IntFormat :: U64 => "u64" . to_string ( ) ,
53- IntFormat :: I8 => "i8" . to_string ( ) ,
54- IntFormat :: I16 => "i16" . to_string ( ) ,
55- IntFormat :: I32 => "i32" . to_string ( ) ,
56- IntFormat :: I64 => "i64" . to_string ( ) ,
57- }
46+ impl Display for IntFormat {
47+ fn fmt ( & self , f : & mut std :: fmt :: Formatter < ' _ > ) -> std :: fmt :: Result {
48+ let str = match self {
49+ IntFormat :: U8 => "u8" ,
50+ IntFormat :: U16 => "u16" ,
51+ IntFormat :: U32 => "u32" ,
52+ IntFormat :: U64 => "u64" ,
53+ IntFormat :: I8 => "i8" ,
54+ IntFormat :: I16 => "i16" ,
55+ IntFormat :: I32 => "i32" ,
56+ IntFormat :: I64 => "i64" ,
57+ } ;
58+ write ! ( f , "{}" , str )
5859 }
5960}
6061
0 commit comments