This has been a major frustration of mine ever since I discovered the tool, and while I’ve thus far been willing to swallow my disgust for its preferences in favor of the benefits of an autoformatter, moments like this shake my faith. This is what rustfmt wants to do:

-   let peer = self.connected.iter().reduce(|a,b|
-           if key_distance(a.id, recipient) < key_distance(b.id, recipient) { a } else { b }).unwrap();
+   let peer = self
+           .connected
+           .iter()
+           .reduce(|a, b| {
+                   if key_distance(a.id, recipient) < key_distance(b.id, recipient) {
+                           a
+                   } else {
+                           b
+                   }
+           })
+           .unwrap();

It won’t even accept a modest counter-proposal like moving .connected.iter() to the first line. Nor can I find any settings for rustfmt.toml that can change its mind. Please tell me I am not the only one who hates rustfmt.

  • jokeyrhyme@lemmy.ml
    link
    fedilink
    arrow-up
    6
    ·
    3 years ago

    I love it

    Having tools that are opinionated about line breaks is amazing for my productivity

    I don’t like exactly what it does every time, but overall I spend so much less time fiddling with whitespace