Skip to content

Commit

Permalink
address review comments and fix new clippy findings introduced since …
Browse files Browse the repository at this point in the history
…I made this PR
  • Loading branch information
matthiaskrgr authored and calebcartwright committed Dec 19, 2020
1 parent 21734b8 commit 367a874
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/formatting/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ fn format_derive(
} else if let SeparatorTactic::Always = context.config.trailing_comma() {
// Retain the trailing comma.
result.push_str(&item_str);
} else if item_str.ends_with(",") {
} else if item_str.ends_with(',') {
// Remove the trailing comma.
result.push_str(&item_str[..item_str.len() - 1]);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/formatting/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1704,8 +1704,8 @@ impl<'a> Iterator for CommentReducer<'a> {
fn remove_comment_header(comment: &str) -> &str {
if comment.starts_with("///") || comment.starts_with("//!") {
&comment[3..]
} else if comment.starts_with("//") {
&comment[2..]
} else if let Some(stripped) = comment.strip_prefix("//") {
&stripped
} else if (comment.starts_with("/**") && !comment.starts_with("/**/"))
|| comment.starts_with("/*!")
{
Expand Down
19 changes: 9 additions & 10 deletions src/formatting/vertical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,15 @@ impl AlignedItem for ast::StructField {
mk_sp(self.attrs.last().unwrap().span.hi(), self.span.lo())
};
let attrs_extendable = self.ident.is_none() && is_attributes_extendable(&attrs_str);
Some(rewrite_struct_field_prefix(context, self)).and_then(|field_str| {
combine_strs_with_missing_comments(
context,
&attrs_str,
&field_str,
missing_span,
shape,
attrs_extendable,
)
})
let prefix = rewrite_struct_field_prefix(context, self);
combine_strs_with_missing_comments(
context,
&attrs_str,
&prefix,
missing_span,
shape,
attrs_extendable,
)
}

fn rewrite_aligned_item(
Expand Down

0 comments on commit 367a874

Please sign in to comment.