diff --git a/benchmarks/benches/handlebars.rs b/benchmarks/benches/handlebars.rs index 321ce20..757e19b 100644 --- a/benchmarks/benches/handlebars.rs +++ b/benchmarks/benches/handlebars.rs @@ -34,12 +34,14 @@ fn make_data() -> BTreeMap<String, Json> { let mut teams = Vec::new(); - for v in vec![("Jiangsu", 43u16), - ("Beijing", 27u16), - ("Guangzhou", 22u16), - ("Shandong", 12u16)] - .iter() { - let (name, score) = *v; + for &(name, score) in + &[ + ("Jiangsu", 43u16), + ("Beijing", 27u16), + ("Guangzhou", 22u16), + ("Shandong", 12u16), + ] + { let mut t = BTreeMap::new(); t.insert("name".to_string(), name.to_json()); t.insert("score".to_string(), score.to_json()); @@ -54,7 +56,6 @@ fn make_data() -> BTreeMap<String, Json> { fn render_template(b: &mut test::Bencher) { let mut handlebars = Handlebars::new(); handlebars.register_template_string("table", SOURCE.to_string()) - .ok() .expect("Invalid template format"); let data = make_data(); diff --git a/maud_macros/tests/control_structures.rs b/maud_macros/tests/control_structures.rs index 1f4332f..42c40b3 100644 --- a/maud_macros/tests/control_structures.rs +++ b/maud_macros/tests/control_structures.rs @@ -23,7 +23,7 @@ fn if_expr() { #[test] fn if_let() { - for &(input, output) in [(Some("yay"), "yay"), (None, "oh noes")].iter() { + for &(input, output) in &[(Some("yay"), "yay"), (None, "oh noes")] { let s = html! { @if let Some(value) = input { (value) @@ -49,6 +49,7 @@ fn while_expr() { #[test] fn while_let_expr() { let mut numbers = (0..3).into_iter(); + #[allow(while_let_on_iterator)] // Clippy let s = html! { ul @while let Some(n) = numbers.next() { li (n) @@ -75,7 +76,7 @@ fn for_expr() { #[test] fn match_expr() { - for &(input, output) in [(Some("yay"), "<div>yay</div>"), (None, "oh noes")].iter() { + for &(input, output) in &[(Some("yay"), "<div>yay</div>"), (None, "oh noes")] { let s = html! { @match input { Some(value) => { @@ -92,7 +93,7 @@ fn match_expr() { #[test] fn match_expr_without_delims() { - for &(input, output) in [(Some("yay"), "yay"), (None, "<span>oh noes</span>")].iter() { + for &(input, output) in &[(Some("yay"), "yay"), (None, "<span>oh noes</span>")] { let s = html! { @match input { Some(value) => (value), @@ -105,7 +106,7 @@ fn match_expr_without_delims() { #[test] fn match_expr_with_guards() { - for &(input, output) in [(Some(1), "one"), (None, "none"), (Some(2), "2")].iter() { + for &(input, output) in &[(Some(1), "one"), (None, "none"), (Some(2), "2")] { let s = html! { @match input { Some(value) if value == 1 => "one", @@ -119,7 +120,7 @@ fn match_expr_with_guards() { #[test] fn match_in_attribute() { - for &(input, output) in [(1, "<span class=\"one\">1</span>"), (2, "<span class=\"two\">2</span>"), (3, "<span class=\"many\">3</span>")].iter() { + for &(input, output) in &[(1, "<span class=\"one\">1</span>"), (2, "<span class=\"two\">2</span>"), (3, "<span class=\"many\">3</span>")] { let s = html! { span class=@match input { 1 => "one", diff --git a/maud_macros/tests/splices.rs b/maud_macros/tests/splices.rs index b26e572..679f0f7 100644 --- a/maud_macros/tests/splices.rs +++ b/maud_macros/tests/splices.rs @@ -116,6 +116,6 @@ fn splice_with_path() { #[test] fn nested_macro_invocation() { let best_pony = "Pinkie Pie"; - let s = html!((format!("{}", best_pony))).into_string(); - assert_eq!(s, "Pinkie Pie"); + let s = html!((format!("{} is best pony", best_pony))).into_string(); + assert_eq!(s, "Pinkie Pie is best pony"); }