@@ -31,12 +31,12 @@ impl fmt::Display for Token<'_> {
31
31
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
32
32
match self {
33
33
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}" ) ,
40
40
Token :: Fn => write ! ( f, "fn" ) ,
41
41
Token :: Let => write ! ( f, "let" ) ,
42
42
Token :: Print => write ! ( f, "print" ) ,
@@ -119,7 +119,7 @@ impl Value<'_> {
119
119
} else {
120
120
Err ( Error {
121
121
span,
122
- msg : format ! ( "'{}' is not a number" , self ) ,
122
+ msg : format ! ( "'{self }' is not a number" ) ,
123
123
} )
124
124
}
125
125
}
@@ -129,9 +129,9 @@ impl std::fmt::Display for Value<'_> {
129
129
fn fmt ( & self , f : & mut std:: fmt:: Formatter ) -> std:: fmt:: Result {
130
130
match self {
131
131
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}" ) ,
135
135
Self :: List ( xs) => write ! (
136
136
f,
137
137
"[{}]" ,
@@ -140,7 +140,7 @@ impl std::fmt::Display for Value<'_> {
140
140
. collect:: <Vec <_>>( )
141
141
. join( ", " )
142
142
) ,
143
- Self :: Func ( name) => write ! ( f, "<function: {}>" , name ) ,
143
+ Self :: Func ( name) => write ! ( f, "<function: {name }>" ) ,
144
144
}
145
145
}
146
146
}
@@ -435,7 +435,7 @@ where
435
435
if funcs. insert ( name, f) . is_some ( ) {
436
436
emitter. emit ( Rich :: custom (
437
437
name_span,
438
- format ! ( "Function '{}' already exists" , name ) ,
438
+ format ! ( "Function '{name }' already exists" ) ,
439
439
) ) ;
440
440
}
441
441
}
@@ -470,7 +470,7 @@ fn eval_expr<'src>(
470
470
. or_else ( || Some ( Value :: Func ( name) ) . filter ( |_| funcs. contains_key ( name) ) )
471
471
. ok_or_else ( || Error {
472
472
span : expr. 1 ,
473
- msg : format ! ( "No such variable '{}' in scope" , name ) ,
473
+ msg : format ! ( "No such variable '{name }' in scope" ) ,
474
474
} ) ?,
475
475
Expr :: Let ( local, val, body) => {
476
476
let val = eval_expr ( val, funcs, stack) ?;
@@ -509,7 +509,7 @@ fn eval_expr<'src>(
509
509
let mut stack = if f. args . len ( ) != args. 0 . len ( ) {
510
510
return Err ( Error {
511
511
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( ) ) ,
513
513
} ) ;
514
514
} else {
515
515
f. args
@@ -523,7 +523,7 @@ fn eval_expr<'src>(
523
523
f => {
524
524
return Err ( Error {
525
525
span : func. 1 ,
526
- msg : format ! ( "'{:?}' is not callable" , f ) ,
526
+ msg : format ! ( "'{f :?}' is not callable" ) ,
527
527
} )
528
528
}
529
529
}
@@ -536,14 +536,14 @@ fn eval_expr<'src>(
536
536
c => {
537
537
return Err ( Error {
538
538
span : cond. 1 ,
539
- msg : format ! ( "Conditions must be booleans, found '{:?}'" , c ) ,
539
+ msg : format ! ( "Conditions must be booleans, found '{c :?}'" ) ,
540
540
} )
541
541
}
542
542
}
543
543
}
544
544
Expr :: Print ( a) => {
545
545
let val = eval_expr ( a, funcs, stack) ?;
546
- println ! ( "{}" , val ) ;
546
+ println ! ( "{val}" ) ;
547
547
val
548
548
}
549
549
} )
@@ -574,7 +574,7 @@ fn main() {
574
574
) )
575
575
} else {
576
576
match eval_expr ( & main. body , & funcs, & mut Vec :: new ( ) ) {
577
- Ok ( val) => println ! ( "Return value: {}" , val ) ,
577
+ Ok ( val) => println ! ( "Return value: {val}" ) ,
578
578
Err ( e) => errs. push ( Rich :: custom ( e. span , e. msg ) ) ,
579
579
}
580
580
}
@@ -609,7 +609,7 @@ fn main() {
609
609
)
610
610
. with_labels ( e. contexts ( ) . map ( |( label, span) | {
611
611
Label :: new ( ( filename. clone ( ) , span. into_range ( ) ) )
612
- . with_message ( format ! ( "while parsing this {}" , label ) )
612
+ . with_message ( format ! ( "while parsing this {label}" ) )
613
613
. with_color ( Color :: Yellow )
614
614
} ) )
615
615
. finish ( )
0 commit comments