Skip to content

Commit

Permalink
hacky solution that makes the tests pass but should really be better
Browse files Browse the repository at this point in the history
  • Loading branch information
radix committed Feb 16, 2018
1 parent 4528a57 commit f5c4655
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion rustfmt-core/src/items.rs
Expand Up @@ -1203,7 +1203,9 @@ pub fn format_struct_struct(
one_line_budget,
)?;

if !items_str.contains('\n') && !result.contains('\n') && items_str.len() <= one_line_budget {
if !items_str.contains('\n') && !result.contains('\n') && items_str.len() <= one_line_budget
&& !items_str.contains("//")
{
Some(format!("{} {} }}", result, items_str))
} else {
Some(format!(
Expand Down
2 changes: 1 addition & 1 deletion rustfmt-core/tests/source/issue-2446.rs
@@ -1,5 +1,5 @@
enum Issue2446 {
V {
f: u8, //
f: u8, // x
},
}
2 changes: 1 addition & 1 deletion rustfmt-core/tests/target/issue-2446.rs
@@ -1,5 +1,5 @@
enum Issue2446 {
V {
f: u8, //
f: u8, // x
},
}

0 comments on commit f5c4655

Please sign in to comment.