Skip to content

Unintuitive use_small_heuristics #2636

Closed
@Ekleog

Description

@Ekleog

The documentation states “Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'.”

So my definition of “small” here is obviously subjective.

Anyway, I'd have expected rustfmt 0.4.2-nightly (dd807e2 2018-04-18) to have put the following on a single line:

             (self.code.code() % 10) as u8 + b'0',
         ];
         w.write_all(code)?;
-        w.write_all(if self.is_last == IsLastLine::Yes { b" " } else { b"-" })?;
+        w.write_all(if self.is_last == IsLastLine::Yes {
+            b" "
+        } else {
+            b"-"
+        })?;
         w.write_all(self.line)?;
         w.write_all(b"\r\n")
     }
 
 impl<'a> fmt::Debug for EhloCommand<'a> {
     fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error> {
-        write!(f, "EhloCommand {{ domain: {:?} }}", bytes_to_dbg(self.domain))
+        write!(
+            f,
+            "EhloCommand {{ domain: {:?} }}",
+            bytes_to_dbg(self.domain)
+        )
     }
 }
 
         } else {
-            Ok(Reply { code, is_last, line })
+            Ok(Reply {
+                code,
+                is_last,
+                line,
+            })
         }

Then maybe my definition of “small line” is not the same as the one of other people, so maybe an option for tweaking the “sensitivity” of the smallness heuristic could help here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions