11#![ allow( unused) ]
22use super :: Input ;
3- use proc_macro2:: { token_stream , Delimiter , Punct , Span , TokenStream , TokenTree } ;
4- use quote:: { quote_spanned , ToTokens } ;
3+ use proc_macro2:: { Delimiter , Punct , Span , TokenStream , TokenTree , token_stream } ;
4+ use quote:: { ToTokens , quote_spanned } ;
55use std:: { fmt:: Display , iter:: Peekable } ;
66
77#[ derive( Clone ) ]
@@ -39,7 +39,7 @@ impl core::fmt::Debug for OpTree {
3939 . debug_tuple ( & unary. kind . to_string ( ) )
4040 . field ( & unary. subj )
4141 . finish ( ) ,
42- Self :: LitInt ( arg0) => write ! ( f, "{}" , arg0 ) ,
42+ Self :: LitInt ( arg0) => write ! ( f, "{arg0}" ) ,
4343 }
4444 }
4545}
@@ -80,13 +80,17 @@ impl InfixKind {
8080
8181impl core:: fmt:: Display for InfixKind {
8282 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
83- write ! ( f, "{}" , match self {
84- InfixKind :: Add => "+" ,
85- InfixKind :: Mul => "*" ,
86- InfixKind :: Sub => "-" ,
87- InfixKind :: LinComb => ".*" ,
88- InfixKind :: Div => "/" ,
89- } )
83+ write ! (
84+ f,
85+ "{}" ,
86+ match self {
87+ InfixKind :: Add => "+" ,
88+ InfixKind :: Mul => "*" ,
89+ InfixKind :: Sub => "-" ,
90+ InfixKind :: LinComb => ".*" ,
91+ InfixKind :: Div => "/" ,
92+ }
93+ )
9094 }
9195}
9296
@@ -105,10 +109,14 @@ pub enum UnaryKind {
105109
106110impl core:: fmt:: Display for UnaryKind {
107111 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
108- write ! ( f, "{}" , match self {
109- UnaryKind :: Neg => "-" ,
110- UnaryKind :: Ref => "&" ,
111- } )
112+ write ! (
113+ f,
114+ "{}" ,
115+ match self {
116+ UnaryKind :: Neg => "-" ,
117+ UnaryKind :: Ref => "&" ,
118+ }
119+ )
112120 }
113121}
114122
@@ -155,7 +163,7 @@ fn rule_term(input: &mut Input) -> Result<Node, Error> {
155163 return Err ( Error {
156164 span : group. span ( ) ,
157165 problem : "can only use '(..)' or '{..}'" . into ( ) ,
158- } )
166+ } ) ;
159167 }
160168 }
161169 }
@@ -171,7 +179,7 @@ fn rule_term(input: &mut Input) -> Result<Node, Error> {
171179 return Err ( Error {
172180 span : tt. span ( ) ,
173181 problem : "this is an invalid term" . into ( ) ,
174- } )
182+ } ) ;
175183 }
176184 } ;
177185
0 commit comments