Skip to content
This repository was archived by the owner on Aug 18, 2025. It is now read-only.

Commit c4b839e

Browse files
committed
Sort match arms in alphabetic order
1 parent 7d8b92e commit c4b839e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

src/types.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@ impl FromStr for Type {
8686
fn from_str(val: &str) -> Result<Self, Self::Err> {
8787
Ok(Self::Builtin(match val {
8888
"bigint" => PgType::INT8,
89+
"boolean" => PgType::BOOL,
90+
"bytea" => PgType::BYTEA,
91+
"bytea[]" => PgType::BYTEA_ARRAY,
8992
"integer" | "int4" => PgType::INT4,
9093
"text" | "character varying" => PgType::TEXT,
9194
"text[]" => PgType::TEXT_ARRAY,
92-
"bytea" => PgType::BYTEA,
93-
"bytea[]" => PgType::BYTEA_ARRAY,
94-
"boolean" => PgType::BOOL,
9595
"timestamp with time zone" => PgType::TIMESTAMPTZ,
9696
"timestamp without time zone" => PgType::TIMESTAMP,
9797
_ => todo!("FromStr for {val:?}"),
@@ -103,13 +103,13 @@ impl fmt::Display for Type {
103103
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
104104
use Type::*;
105105
match self {
106-
Builtin(PgType::INT8) => write!(fmt, "i64"),
106+
Builtin(PgType::BOOL) => write!(fmt, "bool"),
107+
Builtin(PgType::BYTEA) => write!(fmt, "Vec<u8>"),
108+
Builtin(PgType::BYTEA_ARRAY) => write!(fmt, "Vec<Vec<u8>>"),
107109
Builtin(PgType::INT4) => write!(fmt, "i32"),
110+
Builtin(PgType::INT8) => write!(fmt, "i64"),
108111
Builtin(PgType::TEXT) => write!(fmt, "String"),
109112
Builtin(PgType::TEXT_ARRAY) => write!(fmt, "Vec<String>"),
110-
Builtin(PgType::BYTEA) => write!(fmt, "Vec<u8>"),
111-
Builtin(PgType::BYTEA_ARRAY) => write!(fmt, "Vec<Vec<u8>>"),
112-
Builtin(PgType::BOOL) => write!(fmt, "bool"),
113113
Builtin(PgType::TIMESTAMP) => write!(fmt, "chrono::naive::NaiveDateTime"),
114114
Builtin(PgType::TIMESTAMPTZ) => write!(fmt, "chrono::DateTime<chrono::Utc>"),
115115
Composite(inner) => write!(fmt, "{}", AsUpperCamelCase(&inner.name)),

0 commit comments

Comments
 (0)