Fix Clippy warnings
This commit is contained in:
parent
872a9f5cbc
commit
202cc8decf
3 changed files with 16 additions and 14 deletions
|
@ -34,12 +34,14 @@ fn make_data() -> BTreeMap<String, Json> {
|
||||||
|
|
||||||
let mut teams = Vec::new();
|
let mut teams = Vec::new();
|
||||||
|
|
||||||
for v in vec![("Jiangsu", 43u16),
|
for &(name, score) in
|
||||||
("Beijing", 27u16),
|
&[
|
||||||
("Guangzhou", 22u16),
|
("Jiangsu", 43u16),
|
||||||
("Shandong", 12u16)]
|
("Beijing", 27u16),
|
||||||
.iter() {
|
("Guangzhou", 22u16),
|
||||||
let (name, score) = *v;
|
("Shandong", 12u16),
|
||||||
|
]
|
||||||
|
{
|
||||||
let mut t = BTreeMap::new();
|
let mut t = BTreeMap::new();
|
||||||
t.insert("name".to_string(), name.to_json());
|
t.insert("name".to_string(), name.to_json());
|
||||||
t.insert("score".to_string(), score.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) {
|
fn render_template(b: &mut test::Bencher) {
|
||||||
let mut handlebars = Handlebars::new();
|
let mut handlebars = Handlebars::new();
|
||||||
handlebars.register_template_string("table", SOURCE.to_string())
|
handlebars.register_template_string("table", SOURCE.to_string())
|
||||||
.ok()
|
|
||||||
.expect("Invalid template format");
|
.expect("Invalid template format");
|
||||||
|
|
||||||
let data = make_data();
|
let data = make_data();
|
||||||
|
|
|
@ -23,7 +23,7 @@ fn if_expr() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn if_let() {
|
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! {
|
let s = html! {
|
||||||
@if let Some(value) = input {
|
@if let Some(value) = input {
|
||||||
(value)
|
(value)
|
||||||
|
@ -49,6 +49,7 @@ fn while_expr() {
|
||||||
#[test]
|
#[test]
|
||||||
fn while_let_expr() {
|
fn while_let_expr() {
|
||||||
let mut numbers = (0..3).into_iter();
|
let mut numbers = (0..3).into_iter();
|
||||||
|
#[allow(while_let_on_iterator)] // Clippy
|
||||||
let s = html! {
|
let s = html! {
|
||||||
ul @while let Some(n) = numbers.next() {
|
ul @while let Some(n) = numbers.next() {
|
||||||
li (n)
|
li (n)
|
||||||
|
@ -75,7 +76,7 @@ fn for_expr() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_expr() {
|
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! {
|
let s = html! {
|
||||||
@match input {
|
@match input {
|
||||||
Some(value) => {
|
Some(value) => {
|
||||||
|
@ -92,7 +93,7 @@ fn match_expr() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_expr_without_delims() {
|
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! {
|
let s = html! {
|
||||||
@match input {
|
@match input {
|
||||||
Some(value) => (value),
|
Some(value) => (value),
|
||||||
|
@ -105,7 +106,7 @@ fn match_expr_without_delims() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_expr_with_guards() {
|
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! {
|
let s = html! {
|
||||||
@match input {
|
@match input {
|
||||||
Some(value) if value == 1 => "one",
|
Some(value) if value == 1 => "one",
|
||||||
|
@ -119,7 +120,7 @@ fn match_expr_with_guards() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn match_in_attribute() {
|
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! {
|
let s = html! {
|
||||||
span class=@match input {
|
span class=@match input {
|
||||||
1 => "one",
|
1 => "one",
|
||||||
|
|
|
@ -116,6 +116,6 @@ fn splice_with_path() {
|
||||||
#[test]
|
#[test]
|
||||||
fn nested_macro_invocation() {
|
fn nested_macro_invocation() {
|
||||||
let best_pony = "Pinkie Pie";
|
let best_pony = "Pinkie Pie";
|
||||||
let s = html!((format!("{}", best_pony))).into_string();
|
let s = html!((format!("{} is best pony", best_pony))).into_string();
|
||||||
assert_eq!(s, "Pinkie Pie");
|
assert_eq!(s, "Pinkie Pie is best pony");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue