File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -202,16 +202,14 @@ fn migrate_ts_type_defs(value: &mut serde_json::Value) {
202202 serde_json:: Value :: Object ( obj) => {
203203 // If this looks like a v1 TsTypeDef (has "repr" and "kind"), rename
204204 // the kind-named content key to "value".
205- if obj. contains_key ( "repr" ) {
206- if let Some ( kind_str) = obj
205+ if obj. contains_key ( "repr" )
206+ && let Some ( kind_str) = obj
207207 . get ( "kind" )
208208 . and_then ( |k| k. as_str ( ) )
209209 . map ( |s| s. to_string ( ) )
210- {
211- if let Some ( content) = obj. remove ( & kind_str) {
212- obj. insert ( "value" . to_string ( ) , content) ;
213- }
214- }
210+ && let Some ( content) = obj. remove ( & kind_str)
211+ {
212+ obj. insert ( "value" . to_string ( ) , content) ;
215213 }
216214
217215 for val in obj. values_mut ( ) {
Original file line number Diff line number Diff line change @@ -1981,15 +1981,11 @@ impl Display for TsTypeDef {
19811981 LiteralDefKind :: Template => {
19821982 write ! ( f, "{}" , colors:: green( "`" ) ) ?;
19831983 for ts_type in literal. ts_types . as_ref ( ) . unwrap ( ) {
1984- if let TsTypeDefKind :: Literal ( literal) = & ts_type. kind {
1985- if literal. kind == LiteralDefKind :: String {
1986- write ! (
1987- f,
1988- "{}" ,
1989- colors:: green( literal. string. as_ref( ) . unwrap( ) )
1990- ) ?;
1991- continue ;
1992- }
1984+ if let TsTypeDefKind :: Literal ( literal) = & ts_type. kind
1985+ && literal. kind == LiteralDefKind :: String
1986+ {
1987+ write ! ( f, "{}" , colors:: green( literal. string. as_ref( ) . unwrap( ) ) ) ?;
1988+ continue ;
19931989 }
19941990 write ! (
19951991 f,
You can’t perform that action at this time.
0 commit comments