Skip to content

Commit

Permalink
clippy fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
anweiss committed May 12, 2020
1 parent 65c2ca6 commit 41489b5
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ impl<'a> fmt::Display for Rule<'a> {
} => {
let mut rule_str = String::new();

rule_str.push_str(&format!("{}", rule));
rule_str.push_str(&rule.to_string());

if let Some(comments) = comments_after_rule {
if comments.any_non_newline() {
if let Some(&"\n") = comments.0.first() {
rule_str.push_str(&format!("{}", comments.to_string()));
rule_str.push_str(&comments.to_string());
} else {
rule_str.push_str(&format!(" {}", comments.to_string()));
rule_str.push_str(&format!(" {}", comments));
}
}
}
Expand All @@ -286,12 +286,12 @@ impl<'a> fmt::Display for Rule<'a> {
} => {
let mut rule_str = String::new();

rule_str.push_str(&format!("{}", rule.to_string()));
rule_str.push_str(&rule.to_string());

if let Some(comments) = comments_after_rule {
if comments.any_non_newline() {
if let Some(&"\n") = comments.0.first() {
rule_str.push_str(&format!("{}", comments.to_string()));
rule_str.push_str(&comments.to_string());
} else {
rule_str.push_str(&format!(" {}", comments.to_string()));
}
Expand Down Expand Up @@ -1626,12 +1626,12 @@ impl<'a> fmt::Display for OptionalComma<'a> {
}
}

for (idx, comment) in comments.0.iter().enumerate() {
if idx == 0 && *comment != "\n" {
for (idx, &comment) in comments.0.iter().enumerate() {
if idx == 0 && comment != "\n" {
optcomma_str.push_str(&format!(";{}\n", comment));
} else if idx == 0 {
optcomma_str.push_str(&format!("{}", comment));
} else if *comment != "\n" {
optcomma_str.push_str(&comment.to_string());
} else if comment != "\n" {
optcomma_str.push_str(&format!("\t;{}\n", comment));
} else {
optcomma_str.push_str(&format!("\t{}", comment));
Expand Down

0 comments on commit 41489b5

Please sign in to comment.