@@ -494,21 +494,21 @@ fn convert_table_constraint(
494494 match con. contype ( ) {
495495 pg_query:: protobuf:: ConstrType :: ConstrPrimary => {
496496 let mut columns = extract_string_list ( & con. keys ) ;
497- if columns. is_empty ( ) {
498- if let Some ( col) = context_column {
499- columns . push ( col . to_string ( ) ) ;
500- }
497+ if columns. is_empty ( )
498+ && let Some ( col) = context_column
499+ {
500+ columns . push ( col . to_string ( ) ) ;
501501 }
502502 Some ( TableConstraint :: PrimaryKey { columns } )
503503 }
504504 pg_query:: protobuf:: ConstrType :: ConstrForeign => {
505505 let ref_table = relation_to_qualified_name ( con. pktable . as_ref ( ) ) ;
506506 let ref_columns = extract_string_list ( & con. pk_attrs ) ;
507507 let mut columns = extract_string_list ( & con. fk_attrs ) ;
508- if columns. is_empty ( ) {
509- if let Some ( col) = context_column {
510- columns . push ( col . to_string ( ) ) ;
511- }
508+ if columns. is_empty ( )
509+ && let Some ( col) = context_column
510+ {
511+ columns . push ( col . to_string ( ) ) ;
512512 }
513513 Some ( TableConstraint :: ForeignKey {
514514 name,
@@ -519,10 +519,10 @@ fn convert_table_constraint(
519519 }
520520 pg_query:: protobuf:: ConstrType :: ConstrUnique => {
521521 let mut columns = extract_string_list ( & con. keys ) ;
522- if columns. is_empty ( ) {
523- if let Some ( col) = context_column {
524- columns . push ( col . to_string ( ) ) ;
525- }
522+ if columns. is_empty ( )
523+ && let Some ( col) = context_column
524+ {
525+ columns . push ( col . to_string ( ) ) ;
526526 }
527527 Some ( TableConstraint :: Unique { name, columns } )
528528 }
@@ -729,16 +729,13 @@ fn deparse_node(node: &pg_query::protobuf::Node) -> String {
729729 } ;
730730
731731 // Replace the target list's value with our node
732- if let Some ( stmt) = parse_result. protobuf . stmts . first_mut ( ) {
733- if let Some ( ref mut stmt_node) = stmt. stmt {
734- if let Some ( NodeEnum :: SelectStmt ( ref mut select) ) = stmt_node. node {
735- if let Some ( first_target) = select. target_list . first_mut ( ) {
736- if let Some ( NodeEnum :: ResTarget ( ref mut res) ) = first_target. node {
737- res. val = Some ( Box :: new ( node. clone ( ) ) ) ;
738- }
739- }
740- }
741- }
732+ if let Some ( stmt) = parse_result. protobuf . stmts . first_mut ( )
733+ && let Some ( ref mut stmt_node) = stmt. stmt
734+ && let Some ( NodeEnum :: SelectStmt ( ref mut select) ) = stmt_node. node
735+ && let Some ( first_target) = select. target_list . first_mut ( )
736+ && let Some ( NodeEnum :: ResTarget ( ref mut res) ) = first_target. node
737+ {
738+ res. val = Some ( Box :: new ( node. clone ( ) ) ) ;
742739 }
743740
744741 match pg_query:: deparse ( & parse_result. protobuf ) {
0 commit comments