Enforce rustfmt in CI

This commit is contained in:
Steven Fackler
2018-12-09 18:00:53 -08:00
parent 0db96ff62e
commit 8c3338e37d
2 changed files with 17 additions and 3 deletions

View File

@@ -28,6 +28,8 @@ jobs:
- image: sfackler/rust-postgres-test:5
steps:
- checkout
- run: rustup component add rustfmt
- run: cargo fmt --all -- --check
- *RESTORE_REGISTRY
- run: cargo generate-lockfile
- *SAVE_REGISTRY

View File

@@ -41,7 +41,11 @@ impl<'a> FromSql<'a> for DateTime<Utc> {
}
impl ToSql for DateTime<Utc> {
fn to_sql(&self, type_: &Type, w: &mut Vec<u8>) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
fn to_sql(
&self,
type_: &Type,
w: &mut Vec<u8>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
self.naive_utc().to_sql(type_, w)
}
@@ -59,7 +63,11 @@ impl<'a> FromSql<'a> for DateTime<Local> {
}
impl ToSql for DateTime<Local> {
fn to_sql(&self, type_: &Type, w: &mut Vec<u8>) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
fn to_sql(
&self,
type_: &Type,
w: &mut Vec<u8>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
self.with_timezone(&Utc).to_sql(type_, w)
}
@@ -80,7 +88,11 @@ impl<'a> FromSql<'a> for DateTime<FixedOffset> {
}
impl ToSql for DateTime<FixedOffset> {
fn to_sql(&self, type_: &Type, w: &mut Vec<u8>) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
fn to_sql(
&self,
type_: &Type,
w: &mut Vec<u8>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>> {
self.with_timezone(&Utc).to_sql(type_, w)
}