@@ -57,7 +57,7 @@ impl fmt::Display for ReplicaIdentity {
5757 ReplicaIdentity :: None => f. write_str ( "NONE" ) ,
5858 ReplicaIdentity :: Full => f. write_str ( "FULL" ) ,
5959 ReplicaIdentity :: Default => f. write_str ( "DEFAULT" ) ,
60- ReplicaIdentity :: Index ( idx) => write ! ( f, "USING INDEX {}" , idx ) ,
60+ ReplicaIdentity :: Index ( idx) => write ! ( f, "USING INDEX {idx}" ) ,
6161 }
6262 }
6363}
@@ -450,7 +450,7 @@ pub enum Owner {
450450impl fmt:: Display for Owner {
451451 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
452452 match self {
453- Owner :: Ident ( ident) => write ! ( f, "{}" , ident ) ,
453+ Owner :: Ident ( ident) => write ! ( f, "{ident}" ) ,
454454 Owner :: CurrentRole => write ! ( f, "CURRENT_ROLE" ) ,
455455 Owner :: CurrentUser => write ! ( f, "CURRENT_USER" ) ,
456456 Owner :: SessionUser => write ! ( f, "SESSION_USER" ) ,
@@ -525,7 +525,7 @@ impl fmt::Display for AlterTableOperation {
525525 if * if_not_exists {
526526 write ! ( f, " IF NOT EXISTS" ) ?;
527527 }
528- write ! ( f, " {} ({})" , name , query )
528+ write ! ( f, " {name } ({query })" )
529529 }
530530 AlterTableOperation :: Algorithm { equals, algorithm } => {
531531 write ! (
@@ -540,7 +540,7 @@ impl fmt::Display for AlterTableOperation {
540540 if * if_exists {
541541 write ! ( f, " IF EXISTS" ) ?;
542542 }
543- write ! ( f, " {}" , name )
543+ write ! ( f, " {name}" )
544544 }
545545 AlterTableOperation :: MaterializeProjection {
546546 if_exists,
@@ -551,9 +551,9 @@ impl fmt::Display for AlterTableOperation {
551551 if * if_exists {
552552 write ! ( f, " IF EXISTS" ) ?;
553553 }
554- write ! ( f, " {}" , name ) ?;
554+ write ! ( f, " {name}" ) ?;
555555 if let Some ( partition) = partition {
556- write ! ( f, " IN PARTITION {}" , partition ) ?;
556+ write ! ( f, " IN PARTITION {partition}" ) ?;
557557 }
558558 Ok ( ( ) )
559559 }
@@ -566,9 +566,9 @@ impl fmt::Display for AlterTableOperation {
566566 if * if_exists {
567567 write ! ( f, " IF EXISTS" ) ?;
568568 }
569- write ! ( f, " {}" , name ) ?;
569+ write ! ( f, " {name}" ) ?;
570570 if let Some ( partition) = partition {
571- write ! ( f, " IN PARTITION {}" , partition ) ?;
571+ write ! ( f, " IN PARTITION {partition}" ) ?;
572572 }
573573 Ok ( ( ) )
574574 }
@@ -1168,7 +1168,7 @@ impl fmt::Display for TableConstraint {
11681168 write ! ( f, " ON UPDATE {action}" ) ?;
11691169 }
11701170 if let Some ( characteristics) = characteristics {
1171- write ! ( f, " {}" , characteristics ) ?;
1171+ write ! ( f, " {characteristics}" ) ?;
11721172 }
11731173 Ok ( ( ) )
11741174 }
@@ -1308,7 +1308,7 @@ impl fmt::Display for IndexType {
13081308 Self :: SPGiST => write ! ( f, "SPGIST" ) ,
13091309 Self :: BRIN => write ! ( f, "BRIN" ) ,
13101310 Self :: Bloom => write ! ( f, "BLOOM" ) ,
1311- Self :: Custom ( name) => write ! ( f, "{}" , name ) ,
1311+ Self :: Custom ( name) => write ! ( f, "{name}" ) ,
13121312 }
13131313 }
13141314}
@@ -1426,17 +1426,41 @@ impl fmt::Display for ColumnDef {
14261426pub struct ViewColumnDef {
14271427 pub name : Ident ,
14281428 pub data_type : Option < DataType > ,
1429- pub options : Option < Vec < ColumnOption > > ,
1429+ pub options : Option < ColumnOptions > ,
1430+ }
1431+
1432+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
1433+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
1434+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
1435+ pub enum ColumnOptions {
1436+ CommaSeparated ( Vec < ColumnOption > ) ,
1437+ SpaceSeparated ( Vec < ColumnOption > ) ,
1438+ }
1439+
1440+ impl ColumnOptions {
1441+ pub fn as_slice ( & self ) -> & [ ColumnOption ] {
1442+ match self {
1443+ ColumnOptions :: CommaSeparated ( options) => options. as_slice ( ) ,
1444+ ColumnOptions :: SpaceSeparated ( options) => options. as_slice ( ) ,
1445+ }
1446+ }
14301447}
14311448
14321449impl fmt:: Display for ViewColumnDef {
14331450 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
14341451 write ! ( f, "{}" , self . name) ?;
14351452 if let Some ( data_type) = self . data_type . as_ref ( ) {
1436- write ! ( f, " {}" , data_type ) ?;
1453+ write ! ( f, " {data_type}" ) ?;
14371454 }
14381455 if let Some ( options) = self . options . as_ref ( ) {
1439- write ! ( f, " {}" , display_comma_separated( options. as_slice( ) ) ) ?;
1456+ match options {
1457+ ColumnOptions :: CommaSeparated ( column_options) => {
1458+ write ! ( f, " {}" , display_comma_separated( column_options. as_slice( ) ) ) ?;
1459+ }
1460+ ColumnOptions :: SpaceSeparated ( column_options) => {
1461+ write ! ( f, " {}" , display_separated( column_options. as_slice( ) , " " ) ) ?
1462+ }
1463+ }
14401464 }
14411465 Ok ( ( ) )
14421466 }
@@ -1821,7 +1845,7 @@ impl fmt::Display for ColumnOption {
18211845 } => {
18221846 write ! ( f, "{}" , if * is_primary { "PRIMARY KEY" } else { "UNIQUE" } ) ?;
18231847 if let Some ( characteristics) = characteristics {
1824- write ! ( f, " {}" , characteristics ) ?;
1848+ write ! ( f, " {characteristics}" ) ?;
18251849 }
18261850 Ok ( ( ) )
18271851 }
@@ -1843,7 +1867,7 @@ impl fmt::Display for ColumnOption {
18431867 write ! ( f, " ON UPDATE {action}" ) ?;
18441868 }
18451869 if let Some ( characteristics) = characteristics {
1846- write ! ( f, " {}" , characteristics ) ?;
1870+ write ! ( f, " {characteristics}" ) ?;
18471871 }
18481872 Ok ( ( ) )
18491873 }
@@ -1903,7 +1927,7 @@ impl fmt::Display for ColumnOption {
19031927 write ! ( f, "{parameters}" )
19041928 }
19051929 OnConflict ( keyword) => {
1906- write ! ( f, "ON CONFLICT {:?}" , keyword ) ?;
1930+ write ! ( f, "ON CONFLICT {keyword :?}" ) ?;
19071931 Ok ( ( ) )
19081932 }
19091933 Policy ( parameters) => {
0 commit comments