Change write! to write_str for better rustfmt formatting

This commit is contained in:
Nickolay Ponomarev 2019-07-07 03:22:30 +03:00
parent 275e6b13c9
commit 1b31f03732
4 changed files with 58 additions and 90 deletions

View file

@ -660,19 +660,15 @@ pub enum FileFormat {
impl fmt::Display for FileFormat { impl fmt::Display for FileFormat {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::FileFormat::*; use self::FileFormat::*;
write!( f.write_str(match self {
f, TEXTFILE => "TEXTFILE",
"{}", SEQUENCEFILE => "SEQUENCEFILE",
match self { ORC => "ORC",
TEXTFILE => "TEXTFILE", PARQUET => "PARQUET",
SEQUENCEFILE => "SEQUENCEFILE", AVRO => "AVRO",
ORC => "ORC", RCFILE => "RCFILE",
PARQUET => "PARQUET", JSONFILE => "TEXTFILE",
AVRO => "AVRO", })
RCFILE => "RCFILE",
JSONFILE => "TEXTFILE",
}
)
} }
} }
@ -707,14 +703,10 @@ pub enum ObjectType {
impl fmt::Display for ObjectType { impl fmt::Display for ObjectType {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!( f.write_str(match self {
f, ObjectType::Table => "TABLE",
"{}", ObjectType::View => "VIEW",
match self { })
ObjectType::Table => "TABLE",
ObjectType::View => "VIEW",
}
)
} }
} }
@ -755,14 +747,10 @@ pub enum TransactionAccessMode {
impl fmt::Display for TransactionAccessMode { impl fmt::Display for TransactionAccessMode {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use TransactionAccessMode::*; use TransactionAccessMode::*;
write!( f.write_str(match self {
f, ReadOnly => "READ ONLY",
"{}", ReadWrite => "READ WRITE",
match self { })
ReadOnly => "READ ONLY",
ReadWrite => "READ WRITE",
}
)
} }
} }
@ -777,15 +765,11 @@ pub enum TransactionIsolationLevel {
impl fmt::Display for TransactionIsolationLevel { impl fmt::Display for TransactionIsolationLevel {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use TransactionIsolationLevel::*; use TransactionIsolationLevel::*;
write!( f.write_str(match self {
f, ReadUncommitted => "READ UNCOMMITTED",
"{}", ReadCommitted => "READ COMMITTED",
match self { RepeatableRead => "REPEATABLE READ",
ReadUncommitted => "READ UNCOMMITTED", Serializable => "SERIALIZABLE",
ReadCommitted => "READ COMMITTED", })
RepeatableRead => "REPEATABLE READ",
Serializable => "SERIALIZABLE",
}
)
} }
} }

View file

@ -22,15 +22,11 @@ pub enum UnaryOperator {
impl fmt::Display for UnaryOperator { impl fmt::Display for UnaryOperator {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!( f.write_str(match self {
f, UnaryOperator::Plus => "+",
"{}", UnaryOperator::Minus => "-",
match self { UnaryOperator::Not => "NOT",
UnaryOperator::Plus => "+", })
UnaryOperator::Minus => "-",
UnaryOperator::Not => "NOT",
}
)
} }
} }
@ -56,26 +52,22 @@ pub enum BinaryOperator {
impl fmt::Display for BinaryOperator { impl fmt::Display for BinaryOperator {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!( f.write_str(match self {
f, BinaryOperator::Plus => "+",
"{}", BinaryOperator::Minus => "-",
match self { BinaryOperator::Multiply => "*",
BinaryOperator::Plus => "+", BinaryOperator::Divide => "/",
BinaryOperator::Minus => "-", BinaryOperator::Modulus => "%",
BinaryOperator::Multiply => "*", BinaryOperator::Gt => ">",
BinaryOperator::Divide => "/", BinaryOperator::Lt => "<",
BinaryOperator::Modulus => "%", BinaryOperator::GtEq => ">=",
BinaryOperator::Gt => ">", BinaryOperator::LtEq => "<=",
BinaryOperator::Lt => "<", BinaryOperator::Eq => "=",
BinaryOperator::GtEq => ">=", BinaryOperator::NotEq => "<>",
BinaryOperator::LtEq => "<=", BinaryOperator::And => "AND",
BinaryOperator::Eq => "=", BinaryOperator::Or => "OR",
BinaryOperator::NotEq => "<>", BinaryOperator::Like => "LIKE",
BinaryOperator::And => "AND", BinaryOperator::NotLike => "NOT LIKE",
BinaryOperator::Or => "OR", })
BinaryOperator::Like => "LIKE",
BinaryOperator::NotLike => "NOT LIKE",
}
)
} }
} }

View file

@ -100,15 +100,11 @@ pub enum SetOperator {
impl fmt::Display for SetOperator { impl fmt::Display for SetOperator {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!( f.write_str(match self {
f, SetOperator::Union => "UNION",
"{}", SetOperator::Except => "EXCEPT",
match self { SetOperator::Intersect => "INTERSECT",
SetOperator::Union => "UNION", })
SetOperator::Except => "EXCEPT",
SetOperator::Intersect => "INTERSECT",
}
)
} }
} }

View file

@ -128,18 +128,14 @@ pub enum DateTimeField {
impl fmt::Display for DateTimeField { impl fmt::Display for DateTimeField {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!( f.write_str(match self {
f, DateTimeField::Year => "YEAR",
"{}", DateTimeField::Month => "MONTH",
match self { DateTimeField::Day => "DAY",
DateTimeField::Year => "YEAR", DateTimeField::Hour => "HOUR",
DateTimeField::Month => "MONTH", DateTimeField::Minute => "MINUTE",
DateTimeField::Day => "DAY", DateTimeField::Second => "SECOND",
DateTimeField::Hour => "HOUR", })
DateTimeField::Minute => "MINUTE",
DateTimeField::Second => "SECOND",
}
)
} }
} }