]> git.lizzy.rs Git - rust.git/commitdiff
hacky solution that makes the tests pass but should really be better
authorChristopher Armstrong <radix@twistedmatrix.com>
Fri, 16 Feb 2018 20:09:41 +0000 (14:09 -0600)
committerChristopher Armstrong <radix@twistedmatrix.com>
Fri, 16 Feb 2018 20:14:34 +0000 (14:14 -0600)
rustfmt-core/src/items.rs
rustfmt-core/tests/source/issue-2446.rs
rustfmt-core/tests/target/issue-2446.rs

index 9f3b0a1e6b2efe6b5921662a4c62088349fbece0..6df05183485884f4b5ae55a0e8d6c2eb5214ed9a 100644 (file)
@@ -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!(
index 9d61b5dc247eb161ab7906c63548d3099704f4a6..a5566b79591d25e9bb317768cb2b87d33ef1017f 100644 (file)
@@ -1,5 +1,5 @@
 enum Issue2446 {
     V {
-        f: u8, //
+        f: u8, // x
     },
 }
index 9d61b5dc247eb161ab7906c63548d3099704f4a6..a5566b79591d25e9bb317768cb2b87d33ef1017f 100644 (file)
@@ -1,5 +1,5 @@
 enum Issue2446 {
     V {
-        f: u8, //
+        f: u8, // x
     },
 }