-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enums3 feedback #2127
Comments
Rustlings avoids trying to prevent users from cheesing exercises. It is not a test, it is something people use to learn on their own.
I improved the choice of variable names in the solution in f516da4. But I am not sure that I correctly understood what you mean here. Could you please elaborate?
Teaching about nested pattern matching in a new exercise is a good idea. Could you please open a new issue for this? :) |
i actually didn't cheese it on purpose, it was a mistake and i only found out because i checked the solution myself afterwards, i thought i just needed to make it match what the tests wanted. may be a quirk with how i learn (or avoid learning at all) myself
-> typing this after looking back over the original code just now: i think i was just having a """"little bit"""" of trouble with reading the rustbook. didn't understand how it was accepting r, g, b when they weren't used earlier in the code and i can easily see now that it was using those as u8, u8, u8. |
Then we should improve the tests. You are welcome to open a PR :D |
You can "cheese" enums3 by putting the test's desired values in the match statements:
This passes the test, albeit with a bunch of warnings about how the variables are unused.
Maybe add a second pass test to make sure the values are being passed through from
state.process()
?I also found that I had absolutely no idea why I would be using "r, g, b" over "red, green, blue" when these are not technically defined by me. Is this some function of structs/enums? Is it part of a standard library? Is it specific to rgb?
Also, maybe this exercise should take further advantage of match patterns? If the exercise's purpose is to teach match pattern syntax, I think maybe it should show off exhaustive match patterns as well. (Or maybe there should just be an entire exercise folder dedicated to match patterns, because this throws several new concepts at you at once.)
Hopefully I am not wasting time with this issue, I just found this exercise really confusing.
The text was updated successfully, but these errors were encountered: