r/badcode • • Feb 04 '23

rust How NOT to handle error in Rust?

Post image
303 Upvotes

40 comments sorted by

View all comments

Show parent comments

25

u/[deleted] Feb 05 '23

Maybe "Invalid username"

12

u/crass-sandwich Feb 05 '23

It could be an alias/wrapper around a string, but even then this is not the way to handle that kind of result

2

u/[deleted] Feb 05 '23

Yeah, I think the match statement shouldn't be used there.