Reduce nesting of ifs in SQLType::Decimal::to_string()

This commit is contained in:
Nickolay Ponomarev 2019-03-08 18:24:20 +03:00
parent 451513db5b
commit 5263ee1e9e

View file

@ -76,14 +76,12 @@ impl ToString for SQLType {
SQLType::Decimal(precision, scale) => { SQLType::Decimal(precision, scale) => {
if let Some(scale) = scale { if let Some(scale) = scale {
format!("numeric({},{})", precision.unwrap(), scale) format!("numeric({},{})", precision.unwrap(), scale)
} else { } else if let Some(precision) = precision {
if let Some(precision) = precision {
format!("numeric({})", precision) format!("numeric({})", precision)
} else { } else {
format!("numeric") format!("numeric")
} }
} }
}
SQLType::SmallInt => "smallint".to_string(), SQLType::SmallInt => "smallint".to_string(),
SQLType::Int => "int".to_string(), SQLType::Int => "int".to_string(),
SQLType::BigInt => "bigint".to_string(), SQLType::BigInt => "bigint".to_string(),