@@ -31,12 +31,12 @@ impl fmt::Display for Token<'_> {
3131 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
3232 match self {
3333 Token :: Null => write ! ( f, "null" ) ,
34- Token :: Bool ( x) => write ! ( f, "{}" , x ) ,
35- Token :: Num ( n) => write ! ( f, "{}" , n ) ,
36- Token :: Str ( s) => write ! ( f, "{}" , s ) ,
37- Token :: Op ( s) => write ! ( f, "{}" , s ) ,
38- Token :: Ctrl ( c) => write ! ( f, "{}" , c ) ,
39- Token :: Ident ( s) => write ! ( f, "{}" , s ) ,
34+ Token :: Bool ( x) => write ! ( f, "{x}" ) ,
35+ Token :: Num ( n) => write ! ( f, "{n}" ) ,
36+ Token :: Str ( s) => write ! ( f, "{s}" ) ,
37+ Token :: Op ( s) => write ! ( f, "{s}" ) ,
38+ Token :: Ctrl ( c) => write ! ( f, "{c}" ) ,
39+ Token :: Ident ( s) => write ! ( f, "{s}" ) ,
4040 Token :: Fn => write ! ( f, "fn" ) ,
4141 Token :: Let => write ! ( f, "let" ) ,
4242 Token :: Print => write ! ( f, "print" ) ,
@@ -119,7 +119,7 @@ impl Value<'_> {
119119 } else {
120120 Err ( Error {
121121 span,
122- msg : format ! ( "'{}' is not a number" , self ) ,
122+ msg : format ! ( "'{self }' is not a number" ) ,
123123 } )
124124 }
125125 }
@@ -129,9 +129,9 @@ impl std::fmt::Display for Value<'_> {
129129 fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
130130 match self {
131131 Self :: Null => write ! ( f, "null" ) ,
132- Self :: Bool ( x) => write ! ( f, "{}" , x ) ,
133- Self :: Num ( x) => write ! ( f, "{}" , x ) ,
134- Self :: Str ( x) => write ! ( f, "{}" , x ) ,
132+ Self :: Bool ( x) => write ! ( f, "{x}" ) ,
133+ Self :: Num ( x) => write ! ( f, "{x}" ) ,
134+ Self :: Str ( x) => write ! ( f, "{x}" ) ,
135135 Self :: List ( xs) => write ! (
136136 f,
137137 "[{}]" ,
@@ -140,7 +140,7 @@ impl std::fmt::Display for Value<'_> {
140140 . collect:: <Vec <_>>( )
141141 . join( ", " )
142142 ) ,
143- Self :: Func ( name) => write ! ( f, "<function: {}>" , name ) ,
143+ Self :: Func ( name) => write ! ( f, "<function: {name }>" ) ,
144144 }
145145 }
146146}
@@ -435,7 +435,7 @@ where
435435 if funcs. insert ( name, f) . is_some ( ) {
436436 emitter. emit ( Rich :: custom (
437437 name_span,
438- format ! ( "Function '{}' already exists" , name ) ,
438+ format ! ( "Function '{name }' already exists" ) ,
439439 ) ) ;
440440 }
441441 }
@@ -470,7 +470,7 @@ fn eval_expr<'src>(
470470 . or_else ( || Some ( Value :: Func ( name) ) . filter ( |_| funcs. contains_key ( name) ) )
471471 . ok_or_else ( || Error {
472472 span : expr. 1 ,
473- msg : format ! ( "No such variable '{}' in scope" , name ) ,
473+ msg : format ! ( "No such variable '{name }' in scope" ) ,
474474 } ) ?,
475475 Expr :: Let ( local, val, body) => {
476476 let val = eval_expr ( val, funcs, stack) ?;
@@ -509,7 +509,7 @@ fn eval_expr<'src>(
509509 let mut stack = if f. args . len ( ) != args. 0 . len ( ) {
510510 return Err ( Error {
511511 span : expr. 1 ,
512- msg : format ! ( "'{}' called with wrong number of arguments (expected {}, found {})" , name , f. args. len( ) , args. 0 . len( ) ) ,
512+ msg : format ! ( "'{}' called with wrong number of arguments (expected {name }, found {})" , f. args. len( ) , args. 0 . len( ) ) ,
513513 } ) ;
514514 } else {
515515 f. args
@@ -523,7 +523,7 @@ fn eval_expr<'src>(
523523 f => {
524524 return Err ( Error {
525525 span : func. 1 ,
526- msg : format ! ( "'{:?}' is not callable" , f ) ,
526+ msg : format ! ( "'{f :?}' is not callable" ) ,
527527 } )
528528 }
529529 }
@@ -536,14 +536,14 @@ fn eval_expr<'src>(
536536 c => {
537537 return Err ( Error {
538538 span : cond. 1 ,
539- msg : format ! ( "Conditions must be booleans, found '{:?}'" , c ) ,
539+ msg : format ! ( "Conditions must be booleans, found '{c :?}'" ) ,
540540 } )
541541 }
542542 }
543543 }
544544 Expr :: Print ( a) => {
545545 let val = eval_expr ( a, funcs, stack) ?;
546- println ! ( "{}" , val ) ;
546+ println ! ( "{val}" ) ;
547547 val
548548 }
549549 } )
@@ -574,7 +574,7 @@ fn main() {
574574 ) )
575575 } else {
576576 match eval_expr ( & main. body , & funcs, & mut Vec :: new ( ) ) {
577- Ok ( val) => println ! ( "Return value: {}" , val ) ,
577+ Ok ( val) => println ! ( "Return value: {val}" ) ,
578578 Err ( e) => errs. push ( Rich :: custom ( e. span , e. msg ) ) ,
579579 }
580580 }
@@ -609,7 +609,7 @@ fn main() {
609609 )
610610 . with_labels ( e. contexts ( ) . map ( |( label, span) | {
611611 Label :: new ( ( filename. clone ( ) , span. into_range ( ) ) )
612- . with_message ( format ! ( "while parsing this {}" , label ) )
612+ . with_message ( format ! ( "while parsing this {label}" ) )
613613 . with_color ( Color :: Yellow )
614614 } ) )
615615 . finish ( )
0 commit comments