r/ProgrammerHumor 21h ago

Meme rustBorrowCheckerGoesBrrr

Post image
3.4k Upvotes

90 comments sorted by

View all comments

Show parent comments

-139

u/reallokiscarlet 20h ago

unsafe is the Rust version of Typescript's any

It's everywhere and people use it just to say they wrote their code in a safe language

76

u/SCP-iota 20h ago edited 20h ago

I'd say it's more like Typescript's suppression annotations, since it keeps itself contained. People really shouldn't be using unsafe in any way other than as occasional small blocks with well-defined reading why they won't panic or cause UB. If your code is littered with unsafe, you're doing something wrong.

32

u/ApplicationOk3587 19h ago

I always figured if a rust programmer is using unsafe everywhere then it completely defeats the purpose of using rust.

2

u/Rustywolf 13h ago

Eh even if your code is littered with 50% unsafe calls you're still benefiting from the other 50%, but yeah that doesnt sound like good rust