aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2021-06-28 17:12:33 -0600
committerMelody Horn <melody@boringcactus.com>2021-06-28 17:12:33 -0600
commit42d14c943eb31753489b39ef58803c543c023bee (patch)
treee5c7d9e3784192ebdc390dfa481631eaad07f0fd /examples
parentb1ec80c918dd9e156c049a500983fb15147c6e14 (diff)
downloadtosin-42d14c943eb31753489b39ef58803c543c023bee.tar.gz
tosin-42d14c943eb31753489b39ef58803c543c023bee.zip
fmt
Diffstat (limited to 'examples')
-rw-r--r--examples/tutorial01/main.rs7
-rw-r--r--examples/tutorial01/polls/migrations/mod.rs2
-rw-r--r--examples/tutorial01/polls/models.rs2
-rw-r--r--examples/tutorial01/polls/urls.rs2
-rw-r--r--examples/tutorial02/main.rs19
-rw-r--r--examples/tutorial02/polls/migrations/mod.rs2
-rw-r--r--examples/tutorial02/polls/models.rs6
-rw-r--r--examples/tutorial02/polls/urls.rs2
8 files changed, 19 insertions, 23 deletions
diff --git a/examples/tutorial01/main.rs b/examples/tutorial01/main.rs
index 52ae922..af2f14d 100644
--- a/examples/tutorial01/main.rs
+++ b/examples/tutorial01/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;
diff --git a/examples/tutorial01/polls/migrations/mod.rs b/examples/tutorial01/polls/migrations/mod.rs
index 64efe8d..56fe76d 100644
--- a/examples/tutorial01/polls/migrations/mod.rs
+++ b/examples/tutorial01/polls/migrations/mod.rs
@@ -1,3 +1,3 @@
-use tosin::db::migration::{Migration, gather};
+use tosin::db::migration::{gather, Migration};
gather!();
diff --git a/examples/tutorial01/polls/models.rs b/examples/tutorial01/polls/models.rs
index bc1cd9b..987e4b0 100644
--- a/examples/tutorial01/polls/models.rs
+++ b/examples/tutorial01/polls/models.rs
@@ -1,5 +1,5 @@
#[allow(unused_imports)]
-use tosin::db::models::{Model, Id, gather};
+use tosin::db::models::{gather, Id, Model};
// TODO define models
diff --git a/examples/tutorial01/polls/urls.rs b/examples/tutorial01/polls/urls.rs
index 04d93cc..83f3ecb 100644
--- a/examples/tutorial01/polls/urls.rs
+++ b/examples/tutorial01/polls/urls.rs
@@ -1,4 +1,4 @@
-use tosin::urls::{UrlMap, url_map};
+use tosin::urls::{url_map, UrlMap};
use super::views;
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!
diff --git a/examples/tutorial02/polls/migrations/mod.rs b/examples/tutorial02/polls/migrations/mod.rs
index 64efe8d..56fe76d 100644
--- a/examples/tutorial02/polls/migrations/mod.rs
+++ b/examples/tutorial02/polls/migrations/mod.rs
@@ -1,3 +1,3 @@
-use tosin::db::migration::{Migration, gather};
+use tosin::db::migration::{gather, Migration};
gather!();
diff --git a/examples/tutorial02/polls/models.rs b/examples/tutorial02/polls/models.rs
index c9de156..48e58cc 100644
--- a/examples/tutorial02/polls/models.rs
+++ b/examples/tutorial02/polls/models.rs
@@ -1,9 +1,9 @@
-use tosin::db::models::{Model, Id, gather};
+use tosin::db::models::{gather, Id, Model};
#[derive(Model, PartialEq, Debug)]
pub struct Question {
id: Option<Id>,
- #[model(max_length=200)]
+ #[model(max_length = 200)]
question_text: String,
/// date published
pub_date: chrono::NaiveDateTime,
@@ -14,7 +14,7 @@ pub struct Choice {
id: Option<Id>,
#[model(Question, on_delete=Cascade)]
question: Id,
- #[model(max_length=200)]
+ #[model(max_length = 200)]
choice_text: String,
#[model(default = 0)]
votes: usize,
diff --git a/examples/tutorial02/polls/urls.rs b/examples/tutorial02/polls/urls.rs
index 04d93cc..83f3ecb 100644
--- a/examples/tutorial02/polls/urls.rs
+++ b/examples/tutorial02/polls/urls.rs
@@ -1,4 +1,4 @@
-use tosin::urls::{UrlMap, url_map};
+use tosin::urls::{url_map, UrlMap};
use super::views;