Run 'cargo fmt' to format code (#489)

This commit is contained in:
Atul Bhosale
2019-03-20 22:26:17 +05:30
committed by Baptiste Gelez
parent 732f514da7
commit b945d1f602
58 changed files with 3160 additions and 2195 deletions
+10 -3
View File
@@ -1,4 +1,6 @@
use diesel::{r2d2::{ConnectionManager, CustomizeConnection, Error as ConnError, Pool, PooledConnection}};
use diesel::r2d2::{
ConnectionManager, CustomizeConnection, Error as ConnError, Pool, PooledConnection,
};
#[cfg(feature = "sqlite")]
use diesel::{dsl::sql_query, ConnectionError, RunQueryDsl};
use rocket::{
@@ -47,8 +49,13 @@ pub struct PragmaForeignKey;
impl CustomizeConnection<Connection, ConnError> for PragmaForeignKey {
#[cfg(feature = "sqlite")] // will default to an empty function for postgres
fn on_acquire(&self, conn: &mut Connection) -> Result<(), ConnError> {
sql_query("PRAGMA foreign_keys = on;").execute(conn)
sql_query("PRAGMA foreign_keys = on;")
.execute(conn)
.map(|_| ())
.map_err(|_| ConnError::ConnectionError(ConnectionError::BadConnection(String::from("PRAGMA foreign_keys = on failed"))))
.map_err(|_| {
ConnError::ConnectionError(ConnectionError::BadConnection(String::from(
"PRAGMA foreign_keys = on failed",
)))
})
}
}