Run cargo fmt. r=me

This commit is contained in:
Brian Grinstead 2017-01-10 10:54:37 -08:00
parent 6d10774fc8
commit cd9517e5fd
2 changed files with 16 additions and 12 deletions

View file

@ -18,12 +18,12 @@ use rusqlite::Connection;
pub mod ident; pub mod ident;
pub fn get_name() -> String { pub fn get_name() -> String {
return String::from("mentat"); return String::from("mentat");
} }
// Just an example of using a dependency // Just an example of using a dependency
pub fn get_parser_name() -> String { pub fn get_parser_name() -> String {
return mentat_query_parser::get_name(); return mentat_query_parser::get_name();
} }
// Will ultimately not return the sqlite connection directly // Will ultimately not return the sqlite connection directly

View file

@ -17,7 +17,7 @@ fn can_import_sqlite() {
struct Person { struct Person {
id: i32, id: i32,
name: String, name: String,
data: Option<Vec<u8>> data: Option<Vec<u8>>,
} }
let conn = mentat::get_connection(); let conn = mentat::get_connection();
@ -26,24 +26,28 @@ fn can_import_sqlite() {
id INTEGER PRIMARY KEY, id INTEGER PRIMARY KEY,
name TEXT NOT NULL, name TEXT NOT NULL,
data BLOB data BLOB
)", &[]).unwrap(); )",
&[])
.unwrap();
let me = Person { let me = Person {
id: 1, id: 1,
name: "Steven".to_string(), name: "Steven".to_string(),
data: None data: None,
}; };
conn.execute("INSERT INTO person (name, data) conn.execute("INSERT INTO person (name, data)
VALUES (?1, ?2)", VALUES (?1, ?2)",
&[&me.name, &me.data]).unwrap(); &[&me.name, &me.data])
.unwrap();
let mut stmt = conn.prepare("SELECT id, name, data FROM person").unwrap(); let mut stmt = conn.prepare("SELECT id, name, data FROM person").unwrap();
let person_iter = stmt.query_map(&[], |row| { let person_iter = stmt.query_map(&[], |row| {
Person { Person {
id: row.get(0), id: row.get(0),
name: row.get(1), name: row.get(1),
data: row.get(2) data: row.get(2),
} }
}).unwrap(); })
.unwrap();
for person in person_iter { for person in person_iter {
let p = person.unwrap(); let p = person.unwrap();