@@ -64,7 +64,7 @@ pub struct FormatConfiguration {
6464#[ allow( dead_code) ]  
6565impl  FormatConfiguration  { 
6666 pub  fn  new ( indent :  Option < usize > ,  item_separator :  & str ,  key_separator :  & str ,  trailing_comma :  TrailingComma )  -> Self  { 
67-  FormatConfiguration  { indent :  indent ,  item_separator :  item_separator. to_string ( ) ,  key_separator :  key_separator. to_string ( ) ,  current_indent :  String :: with_capacity ( 64 ) ,   trailing_comma :  trailing_comma} 
67+  FormatConfiguration  { indent,  item_separator :  item_separator. to_string ( ) ,  key_separator :  key_separator. to_string ( ) ,  current_indent :  String :: with_capacity ( 64 ) ,  trailing_comma} 
6868 } 
6969
7070 pub  fn  with_indent ( indent :  usize ,  trailing_comma :  TrailingComma )  -> Self  { 
@@ -94,16 +94,16 @@ impl<'input> JSONValue<'input> {
9494 fn  to_string_formatted ( & self ,  style :  & mut  FormatConfiguration )  -> String  { 
9595 match  self  { 
9696 JSONValue :: Identifier ( s)  | JSONValue :: Integer ( s)  | JSONValue :: Float ( s)  | JSONValue :: Exponent ( s)  | JSONValue :: Hexadecimal ( s)  => { 
97-  format ! ( "{}" ,  s ) 
97+  s . to_string ( ) 
9898 } 
9999 JSONValue :: Bool ( b)  => { 
100-  format ! ( "{}"  ,  b ) 
100+  format ! ( "{b}"  ) 
101101 } 
102102 JSONValue :: DoubleQuotedString ( s)  => { 
103-  format ! ( "\" {}\" " ,  s ) 
103+  format ! ( "\" {s }\" " ) 
104104 } 
105105 JSONValue :: SingleQuotedString ( s)  => { 
106-  format ! ( "'{}'" ,  s ) 
106+  format ! ( "'{s }'" ) 
107107 } 
108108
109109 JSONValue :: Null  => { "null" . to_string ( ) } 
@@ -116,7 +116,7 @@ impl<'input> JSONValue<'input> {
116116 UnaryOperator :: Minus  => { '-' } 
117117 } ; 
118118 let  value_string = value. to_string ( ) ; 
119-  format ! ( "{}{}"  ,  op_char ,  value_string ) 
119+  format ! ( "{op_char}{value_string}"  ) 
120120 } 
121121 JSONValue :: JSONObject  {  key_value_pairs}  => { 
122122 let  mut  ret:  String ; 
@@ -154,7 +154,7 @@ impl<'input> JSONValue<'input> {
154154 } 
155155 match  style. indent  { 
156156 None  => { 
157-  ret. push_str ( "}" ) ; 
157+  ret. push ( '}' ) ; 
158158 } 
159159 Some ( ident)  => { 
160160 style. current_indent . truncate ( style. current_indent . len ( )  - ident) ; 
@@ -199,7 +199,7 @@ impl<'input> JSONValue<'input> {
199199 } 
200200 match  style. indent  { 
201201 None  => { 
202-  ret. push_str ( "]" ) ; 
202+  ret. push ( ']' ) ; 
203203 } 
204204 Some ( ident)  => { 
205205 style. current_indent . truncate ( style. current_indent . len ( )  - ident) ; 
@@ -217,7 +217,7 @@ impl<'input> Display for JSONValue<'input> {
217217 fn  fmt ( & self ,  f :  & mut  Formatter < ' _ > )  -> std:: fmt:: Result  { 
218218 let  mut  style = FormatConfiguration :: default ( ) ; 
219219 let  res = self . to_string_formatted ( & mut  style) ; 
220-  write ! ( f,  "{}"  ,  res ) 
220+  write ! ( f,  "{res}"  ) 
221221 } 
222222} 
223223
@@ -263,7 +263,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
263263 } 
264264
265265 fn  with_max_depth ( tokens :  & ' toks  Tokens < ' input > ,  max_depth :  usize )  -> Self  { 
266-  JSON5Parser  {  source_tokens :  tokens. tok_spans . iter ( ) . peekable ( ) ,  lookahead :  None ,  source :  tokens. source ,  current_depth :  0 ,  max_depth :  max_depth  } 
266+  JSON5Parser  {  source_tokens :  tokens. tok_spans . iter ( ) . peekable ( ) ,  lookahead :  None ,  source :  tokens. source ,  current_depth :  0 ,  max_depth } 
267267 } 
268268
269269 fn  advance ( & mut  self )  -> Option < & ' toks  TokenSpan >  { 
@@ -275,7 +275,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
275275 Some ( span)  => { 
276276 match  span. 1  { 
277277 TokType :: BlockComment  | TokType :: LineComment  | TokType :: Whitespace  => { 
278-  return   self . advance ( ) 
278+  self . advance ( ) 
279279 } 
280280 _ => { 
281281
@@ -400,7 +400,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
400400 } 
401401 Some ( _)  => { 
402402 let  val = self . parse_value ( ) ?; 
403-  let  kvp = JSONKeyValuePair { key :  key ,  value :  val} ; 
403+  let  kvp = JSONKeyValuePair { key,  value :  val} ; 
404404 kvps. push ( kvp) ; 
405405 match  self . check_and_consume ( vec ! [ Comma ] )  { 
406406 None  => { 
@@ -444,7 +444,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
444444 return  Err ( self . make_error ( "Expecting ']' at end of array" . to_string ( ) ,  idx) ) 
445445 } , 
446446 Some ( _)  => { 
447-  break  Ok ( JSONValue :: JSONArray  { values :  values } ) 
447+  break  Ok ( JSONValue :: JSONArray  { values} ) 
448448 } 
449449 } 
450450 } 
@@ -454,7 +454,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
454454 } 
455455 } 
456456 Some ( _)  => { 
457-  break  Ok ( JSONValue :: JSONArray  { values :  values } ) 
457+  break  Ok ( JSONValue :: JSONArray  { values} ) 
458458 } 
459459 } 
460460 } 
@@ -501,7 +501,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
501501 return  Err ( self . make_error ( "Only one unary operator is allowed" . to_string ( ) ,  span. 2 ) ) 
502502 } 
503503 val => { 
504-  return  Err ( self . make_error ( format ! ( "Unary operations not allowed for value {:?}" ,  val ) ,  span. 2 ) ) 
504+  return  Err ( self . make_error ( format ! ( "Unary operations not allowed for value {val :?}" ) ,  span. 2 ) ) 
505505 } 
506506 } 
507507 match  span. 1  { 
@@ -532,13 +532,13 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
532532
533533
534534 fn  parse_value ( & mut  self )  -> Result < JSONValue < ' input > ,  ParsingError >  { 
535-  self . current_depth  =  self . current_depth  +  1 ; 
535+  self . current_depth  +=  1 ; 
536536 if  self . current_depth  > self . max_depth  { 
537537 let  idx = self . position ( ) ; 
538538 return  Err ( self . make_error ( format ! ( "max depth ({}) exceeded in nested arrays/objects. To expand the depth, use the ``with_max_depth`` constructor or enable the `unlimited_depth` feature" ,  self . max_depth) ,  idx) ) 
539539 } 
540540 let  res = self . parse_obj_or_array ( ) ; 
541-  self . current_depth  =  self . current_depth  -  1 ; 
541+  self . current_depth  -=  1 ; 
542542 res
543543 } 
544544
@@ -558,7 +558,7 @@ impl<'toks, 'input> JSON5Parser<'toks, 'input> {
558558
559559
560560/// Like [from_str] but for [Tokens] 
561- pub  fn  from_tokens < ' toks ,   ' input > ( tokens :  & ' toks   Tokens < ' input > )  -> Result < JSONText < ' input > ,  ParsingError >  { 
561+ pub  fn  from_tokens < ' input > ( tokens :  & Tokens < ' input > )  -> Result < JSONText < ' input > ,  ParsingError >  { 
562562 let  mut  parser = JSON5Parser :: new ( tokens) ; 
563563 parser. parse_text ( ) 
564564} 
0 commit comments