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,10 +660,7 @@ 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,
"{}",
match self {
TEXTFILE => "TEXTFILE", TEXTFILE => "TEXTFILE",
SEQUENCEFILE => "SEQUENCEFILE", SEQUENCEFILE => "SEQUENCEFILE",
ORC => "ORC", ORC => "ORC",
@ -671,8 +668,7 @@ impl fmt::Display for FileFormat {
AVRO => "AVRO", AVRO => "AVRO",
RCFILE => "RCFILE", RCFILE => "RCFILE",
JSONFILE => "TEXTFILE", 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,
"{}",
match self {
ObjectType::Table => "TABLE", ObjectType::Table => "TABLE",
ObjectType::View => "VIEW", 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,
"{}",
match self {
ReadOnly => "READ ONLY", ReadOnly => "READ ONLY",
ReadWrite => "READ WRITE", 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,
"{}",
match self {
ReadUncommitted => "READ UNCOMMITTED", ReadUncommitted => "READ UNCOMMITTED",
ReadCommitted => "READ COMMITTED", ReadCommitted => "READ COMMITTED",
RepeatableRead => "REPEATABLE READ", RepeatableRead => "REPEATABLE READ",
Serializable => "SERIALIZABLE", 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,
"{}",
match self {
UnaryOperator::Plus => "+", UnaryOperator::Plus => "+",
UnaryOperator::Minus => "-", UnaryOperator::Minus => "-",
UnaryOperator::Not => "NOT", UnaryOperator::Not => "NOT",
} })
)
} }
} }
@ -56,10 +52,7 @@ 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,
"{}",
match self {
BinaryOperator::Plus => "+", BinaryOperator::Plus => "+",
BinaryOperator::Minus => "-", BinaryOperator::Minus => "-",
BinaryOperator::Multiply => "*", BinaryOperator::Multiply => "*",
@ -75,7 +68,6 @@ impl fmt::Display for BinaryOperator {
BinaryOperator::Or => "OR", BinaryOperator::Or => "OR",
BinaryOperator::Like => "LIKE", BinaryOperator::Like => "LIKE",
BinaryOperator::NotLike => "NOT 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,
"{}",
match self {
SetOperator::Union => "UNION", SetOperator::Union => "UNION",
SetOperator::Except => "EXCEPT", SetOperator::Except => "EXCEPT",
SetOperator::Intersect => "INTERSECT", 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,
"{}",
match self {
DateTimeField::Year => "YEAR", DateTimeField::Year => "YEAR",
DateTimeField::Month => "MONTH", DateTimeField::Month => "MONTH",
DateTimeField::Day => "DAY", DateTimeField::Day => "DAY",
DateTimeField::Hour => "HOUR", DateTimeField::Hour => "HOUR",
DateTimeField::Minute => "MINUTE", DateTimeField::Minute => "MINUTE",
DateTimeField::Second => "SECOND", DateTimeField::Second => "SECOND",
} })
)
} }
} }