Update to get rid of warnings that appeared when upgrading diesel.

One warning remains: unused import: `EmbedMigrations`. This one has been fixed in diesel, but not yet released
This commit is contained in:
Magnus Hoff 2018-06-13 22:03:55 +02:00
parent 604bea0c25
commit 75e33b2766
4 changed files with 6 additions and 6 deletions

View file

@ -1,6 +1,6 @@
use diesel::prelude::*; use diesel::prelude::*;
use diesel::expression::sql_literal::sql; use diesel::expression::sql_literal::sql;
use diesel::types::*; use diesel::sql_types::*;
use r2d2::{CustomizeConnection, Pool}; use r2d2::{CustomizeConnection, Pool};
use r2d2_diesel::{self, ConnectionManager}; use r2d2_diesel::{self, ConnectionManager};

View file

@ -5,7 +5,7 @@
#[macro_use] extern crate bart_derive; #[macro_use] extern crate bart_derive;
#[macro_use] extern crate codegen; #[macro_use] extern crate codegen;
#[macro_use] extern crate diesel_infer_schema; #[macro_use] #[allow(deprecated)] extern crate diesel_infer_schema;
#[macro_use] extern crate diesel_migrations; #[macro_use] extern crate diesel_migrations;
#[macro_use] extern crate diesel; #[macro_use] extern crate diesel;
#[macro_use] extern crate hyper; #[macro_use] extern crate hyper;

View file

@ -49,7 +49,7 @@ impl ArticleRevisionStub {
pub fn link(&self) -> &str { slug_link(&self.slug) } pub fn link(&self) -> &str { slug_link(&self.slug) }
} }
use diesel::types::Text; use diesel::sql_types::Text;
#[derive(Debug, QueryableByName, Serialize)] #[derive(Debug, QueryableByName, Serialize)]
pub struct SearchResult { pub struct SearchResult {
#[sql_type = "Text"] #[sql_type = "Text"]

View file

@ -332,9 +332,9 @@ impl<'a> SyncState<'a> {
let article_id = { let article_id = {
use diesel::expression::sql_literal::sql; use diesel::expression::sql_literal::sql;
// Diesel and SQLite are a bit in disagreement for how this should look: // Diesel and SQLite are a bit in disagreement for how this should look:
sql::<(diesel::types::Integer)>("INSERT INTO articles VALUES (null)") sql::<(diesel::sql_types::Integer)>("INSERT INTO articles VALUES (null)")
.execute(self.db_connection)?; .execute(self.db_connection)?;
sql::<(diesel::types::Integer)>("SELECT LAST_INSERT_ROWID()") sql::<(diesel::sql_types::Integer)>("SELECT LAST_INSERT_ROWID()")
.load::<i32>(self.db_connection)? .load::<i32>(self.db_connection)?
.pop().expect("Statement must evaluate to an integer") .pop().expect("Statement must evaluate to an integer")
}; };
@ -365,7 +365,7 @@ impl<'a> SyncState<'a> {
pub fn search_query(&self, query_string: String, limit: i32, offset: i32, snippet_size: i32) -> Result<Vec<models::SearchResult>, Error> { pub fn search_query(&self, query_string: String, limit: i32, offset: i32, snippet_size: i32) -> Result<Vec<models::SearchResult>, Error> {
use diesel::sql_query; use diesel::sql_query;
use diesel::types::{Integer, Text}; use diesel::sql_types::{Integer, Text};
fn fts_quote(src: &str) -> String { fn fts_quote(src: &str) -> String {
format!("\"{}\"", src.replace('\"', "\"\"")) format!("\"{}\"", src.replace('\"', "\"\""))