this post was submitted on 09 May 2024
12 points (92.9% liked)

Programmer Humor

32555 readers
649 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[โ€“] RustyNova@lemmy.world 0 points 6 months ago (1 children)

It's a lot less readable imo. As well than a cargo fmt later and it's gone (unless there's a nightly setting for it)

[โ€“] Doods@infosec.pub -1 points 6 months ago

Formatters are off-topic for this, styles come first, formatters are developed later.

My other reply:

How about this one? it more closely mirrors the switch example:

match suffix {
'G' | 'g' => mem -= 30,
'M' | 'm' => mem -= 20,
'K' | 'k' => mem -= 10,
_ => {},
}

How about this other one? it goes as far as cloning the switch example's indentation:

match suffix {
'G' | 'g' => {
  mem -= 30;
       }
'M' | 'm' => {
  mem -= 20;
       }
'K' | 'k' => {
  mem -= 10;
       }
_ => {},
}