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) => {
if let Some(scale) = scale {
format!("numeric({},{})", precision.unwrap(), scale)
} else {
if let Some(precision) = precision {
} else if let Some(precision) = precision {
format!("numeric({})", precision)
} else {
format!("numeric")
}
}
}
SQLType::SmallInt => "smallint".to_string(),
SQLType::Int => "int".to_string(),
SQLType::BigInt => "bigint".to_string(),