Fix clippy warnings

And fix bench.
This commit is contained in:
gwenn
2017-02-24 20:10:51 +01:00
parent 4918fb8f50
commit faa94d1246
5 changed files with 18 additions and 17 deletions

View File

@@ -104,9 +104,8 @@ impl FromSql for DateTime<UTC> {
Cow::Borrowed(s)
};
match DateTime::parse_from_rfc3339(&s) {
Ok(dt) => return Ok(dt.with_timezone(&UTC)),
Err(_) => (),
if let Ok(dt) = DateTime::parse_from_rfc3339(&s) {
return Ok(dt.with_timezone(&UTC));
}
}

View File

@@ -17,8 +17,8 @@ impl ToSql for Value {
impl FromSql for Value {
fn column_result(value: ValueRef) -> FromSqlResult<Self> {
match value {
ValueRef::Text(ref s) => serde_json::from_str(s),
ValueRef::Blob(ref b) => serde_json::from_slice(b),
ValueRef::Text(s) => serde_json::from_str(s),
ValueRef::Blob(b) => serde_json::from_slice(b),
_ => return Err(FromSqlError::InvalidType),
}
.map_err(|err| FromSqlError::Other(Box::new(err)))