diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-11-21 20:53:57 +0100 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2017-11-21 20:57:56 +0100 |
commit | 83cc6e0ca3e9878c47593ab737e6bf106ea062db (patch) | |
tree | e3ec5ac6d25c5835792d7fdc094253ab2fade059 /testing | |
parent | 958680aee0fc2d58200382223937e8123fae7459 (diff) | |
download | askama-83cc6e0ca3e9878c47593ab737e6bf106ea062db.tar.gz askama-83cc6e0ca3e9878c47593ab737e6bf106ea062db.tar.bz2 askama-83cc6e0ca3e9878c47593ab737e6bf106ea062db.zip |
Apply suggestions from rustfmt to improve style
Diffstat (limited to '')
-rw-r--r-- | testing/tests/filters.rs | 23 | ||||
-rw-r--r-- | testing/tests/include.rs | 4 | ||||
-rw-r--r-- | testing/tests/inheritance.rs | 5 | ||||
-rw-r--r-- | testing/tests/loops.rs | 8 | ||||
-rw-r--r-- | testing/tests/matches.rs | 2 | ||||
-rw-r--r-- | testing/tests/operators.rs | 4 | ||||
-rw-r--r-- | testing/tests/simple.rs | 15 |
7 files changed, 32 insertions, 29 deletions
diff --git a/testing/tests/filters.rs b/testing/tests/filters.rs index fe218e3..ca5e08d 100644 --- a/testing/tests/filters.rs +++ b/testing/tests/filters.rs @@ -18,9 +18,11 @@ fn filter_escape() { let s = TestTemplate { strvar: "// my <html> is \"unsafe\" & should be 'escaped'".to_string(), }; - assert_eq!(s.render().unwrap(), - "// my <html> is "unsafe" & \ - should be 'escaped'"); + assert_eq!( + s.render().unwrap(), + "// my <html> is "unsafe" & \ + should be 'escaped'" + ); } @@ -57,7 +59,7 @@ fn test_my_filter() { #[derive(Template)] -#[template(path= "filters_join.html")] +#[template(path = "filters_join.html")] struct JoinTemplate<'a> { s: &'a [&'a str], } @@ -69,9 +71,9 @@ fn test_join() { } #[derive(Template)] -#[template(path= "filters_join.html")] +#[template(path = "filters_join.html")] struct VecJoinTemplate { - s: Vec<String> + s: Vec<String>, } #[test] @@ -90,10 +92,12 @@ struct JsonTemplate<'a> { #[test] fn test_json() { - let val = json!({"arr": [ "one", 2, true, null ]}); + let val = json!({"arr": [ "one", 2, true, null ]}); let t = JsonTemplate { foo: "a", bar: &val }; // Note: the json filter lacks a way to specify initial indentation - assert_eq!(t.render().unwrap(), r#"{ + assert_eq!( + t.render().unwrap(), + r#"{ "foo": "a", "bar": { "arr": [ @@ -103,5 +107,6 @@ fn test_json() { null ] } -}"#); +}"# + ); } diff --git a/testing/tests/include.rs b/testing/tests/include.rs index d2998a1..f474c55 100644 --- a/testing/tests/include.rs +++ b/testing/tests/include.rs @@ -12,8 +12,6 @@ struct IncludeTemplate<'a> { #[test] fn test_include() { let strs = vec!["foo", "bar"]; - let s = IncludeTemplate { - strs: &strs, - }; + let s = IncludeTemplate { strs: &strs }; assert_eq!(s.render().unwrap(), "INCLUDED: fooINCLUDED: bar") } diff --git a/testing/tests/inheritance.rs b/testing/tests/inheritance.rs index e9ea9a2..bac9bf5 100644 --- a/testing/tests/inheritance.rs +++ b/testing/tests/inheritance.rs @@ -24,5 +24,8 @@ fn test_use_base_directly() { #[test] fn test_simple_extends() { let t = ChildTemplate { _parent: BaseTemplate { title: "Bar" } }; - assert_eq!(t.render().unwrap(), "Bar\n(Bar) Content goes here\nFoo\nCopyright 2017"); + assert_eq!( + t.render().unwrap(), + "Bar\n(Bar) Content goes here\nFoo\nCopyright 2017" + ); } diff --git a/testing/tests/loops.rs b/testing/tests/loops.rs index 3125598..987f26a 100644 --- a/testing/tests/loops.rs +++ b/testing/tests/loops.rs @@ -11,9 +11,7 @@ struct ForTemplate<'a> { #[test] fn test_for() { - let s = ForTemplate { - strings: vec!["A", "alfa", "1"], - }; + let s = ForTemplate { strings: vec!["A", "alfa", "1"] }; assert_eq!(s.render().unwrap(), "0. A\n1. alfa\n2. 1\n"); } @@ -28,8 +26,6 @@ struct NestedForTemplate<'a> { fn test_nested_for() { let alpha = vec!["a", "b", "c"]; let numbers = vec!["one", "two"]; - let s = NestedForTemplate { - seqs: vec![&alpha, &numbers], - }; + let s = NestedForTemplate { seqs: vec![&alpha, &numbers] }; assert_eq!(s.render().unwrap(), "1\n 0a1b2c2\n 0one1two"); } diff --git a/testing/tests/matches.rs b/testing/tests/matches.rs index 86d32be..8f4b05c 100644 --- a/testing/tests/matches.rs +++ b/testing/tests/matches.rs @@ -68,7 +68,7 @@ fn test_match_literal_num() { enum Color { Rgb(u32, u32, u32), GrayScale(u32), - Cmyk(u32, u32, u32, u32) + Cmyk(u32, u32, u32, u32), } #[derive(Template)] diff --git a/testing/tests/operators.rs b/testing/tests/operators.rs index 625ec29..de51677 100644 --- a/testing/tests/operators.rs +++ b/testing/tests/operators.rs @@ -35,10 +35,10 @@ fn test_operators() { #[derive(Template)] #[template(path = "precedence.html")] -struct PrecedenceTemplate { } +struct PrecedenceTemplate {} #[test] fn test_precedence() { - let t = PrecedenceTemplate { }; + let t = PrecedenceTemplate {}; assert_eq!(t.render().unwrap(), "6".repeat(7)); } diff --git a/testing/tests/simple.rs b/testing/tests/simple.rs index 37027b7..4ed1261 100644 --- a/testing/tests/simple.rs +++ b/testing/tests/simple.rs @@ -19,10 +19,13 @@ fn test_variables() { num: 42, i18n: "Iñtërnâtiônàlizætiøn".to_string(), }; - assert_eq!(s.render().unwrap(), "\nhello world, foo\n\ - with number: 42\n\ - Iñtërnâtiônàlizætiøn is important\n\ - in vars too: Iñtërnâtiônàlizætiøn"); + assert_eq!( + s.render().unwrap(), + "\nhello world, foo\n\ + with number: 42\n\ + Iñtërnâtiônàlizætiøn is important\n\ + in vars too: Iñtërnâtiônàlizætiøn" + ); } @@ -118,9 +121,7 @@ struct NestedAttrTemplate { #[test] fn test_nested_attr() { - let t = NestedAttrTemplate { - inner: NestedHolder { holder: Holder { a: 5 } } - }; + let t = NestedAttrTemplate { inner: NestedHolder { holder: Holder { a: 5 } } }; assert_eq!(t.render().unwrap(), "5"); } |