@@ -354,22 +354,22 @@ impl<'de> Deserialize<'de> for TokenValues {
354354 Value :: Array ( arr) => {
355355 let mut result = Vec :: with_capacity ( arr. len ( ) ) ;
356356 for item in arr {
357- match item {
358- Value :: Null => result . push ( None ) ,
359- Value :: String ( s) => result . push ( Some ( s. clone ( ) ) ) ,
360- Value :: Number ( n) => result . push ( Some ( n. to_string ( ) ) ) ,
357+ result . push ( match item {
358+ Value :: Null => None ,
359+ Value :: String ( s) => Some ( s. clone ( ) ) ,
360+ Value :: Number ( n) => Some ( n. to_string ( ) ) ,
361361 _ => {
362- let msg = format ! ( "Invalid token value: {item:?}" ) ;
363- return Err ( serde:: de:: Error :: custom ( msg) ) ;
362+ return Err ( serde:: de:: Error :: custom ( format ! (
363+ "Invalid token value: {item:?}"
364+ ) ) ) ;
364365 }
365- }
366+ } ) ;
366367 }
367368 Ok ( Self ( result) )
368369 }
369- _ => {
370- let msg = format ! ( "Expected string, number, or array, got: {value:?}" ) ;
371- Err ( serde:: de:: Error :: custom ( msg) )
372- }
370+ _ => Err ( serde:: de:: Error :: custom ( format ! (
371+ "Expected string, number, or array, got: {value:?}"
372+ ) ) ) ,
373373 }
374374 }
375375}
@@ -689,14 +689,13 @@ impl Theme {
689689 if themes. is_empty ( ) {
690690 return ;
691691 }
692- let Some ( default_key) = themes
692+ // Safe: themes is non-empty, so at least one key exists
693+ let default_key = themes
693694 . keys ( )
694695 . find ( |k| * k == "default" )
695696 . or_else ( || themes. keys ( ) . next ( ) )
696697 . cloned ( )
697- else {
698- return ;
699- } ;
698+ . unwrap ( ) ;
700699
701700 // Sort variants: default first, then alphabetical
702701 let mut sorted_variants: Vec < _ > = themes. iter ( ) . collect ( ) ;
0 commit comments