142
submitted 7 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 24 points 7 months ago

ew...

pub fn predict_crime(suspect: Person) -> bool {
   return suspect.race() == Race::Black
}
[-] [email protected] 16 points 7 months ago

Good change but also why is race a getter method while Race::Black is a constant enum? Is race an impure function dependent on global state? Is it derived from some other internal immutable state?

[-] [email protected] 16 points 7 months ago

race() is a getter method as it is dependent on which Eastern and Southern Europeans are considered white at the time

[-] [email protected] 2 points 7 months ago

you dont need the return statement either

[-] [email protected] 2 points 7 months ago

i dont even know what language this is :D i just thought it'd be a nice bit to silently pass over the racism aspect and nitpick the code

[-] [email protected] 2 points 7 months ago

It's Rust.

If you omit the semicolon on the last line, it will return that value, so suspect.race() == Race::Black will return true/false for the containing expression.

this post was submitted on 03 Dec 2024
142 points (100.0% liked)

chapotraphouse

13931 readers
852 users here now

Banned? DM Wmill to appeal.

No anti-nautilism posts. See: Eco-fascism Primer

Slop posts go in c/slop. Don't post low-hanging fruit here.

founded 4 years ago
MODERATORS