diff options
Diffstat (limited to 'examples/tutorial02/main.rs')
-rw-r--r-- | examples/tutorial02/main.rs | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/examples/tutorial02/main.rs b/examples/tutorial02/main.rs index bac20e1..2abac0c 100644 --- a/examples/tutorial02/main.rs +++ b/examples/tutorial02/main.rs @@ -1,9 +1,10 @@ -#[macro_use] extern crate diesel; +#[macro_use] +extern crate diesel; -use tosin::Settings; use tosin::contrib::admin; use tosin::db::backend::Connectable; -use tosin::urls::{UrlMap, url_map}; +use tosin::urls::{url_map, UrlMap}; +use tosin::Settings; mod polls; @@ -16,10 +17,7 @@ fn urls() -> UrlMap { fn settings() -> Settings<impl Connectable> { Settings { - installed_apps: &[ - &polls::APP, - &admin::APP, - ], + installed_apps: &[&polls::APP, &admin::APP], ..Settings::default() } } @@ -33,7 +31,7 @@ mod test { #[test] fn test_models() { - use polls::models::{Choice, Question, choice, question}; + use polls::models::{choice, question, Choice, Question}; let settings = settings(); let connection = settings.database.connect().unwrap(); @@ -43,10 +41,7 @@ mod test { assert!(all_questions.is_empty()); // make a new one - let mut q = Question::new( - "What's new?".to_string(), - time::PrimitiveDateTime::now(), - ); + let mut q = Question::new("What's new?".to_string(), time::PrimitiveDateTime::now()); // save it q.save_mut(); // it's got an id now! |