-
Notifications
You must be signed in to change notification settings - Fork 542
Eliminate stub warnings #497
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
Eliminate stub warnings #497
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some optional changes
exercises/beer-song/src/lib.rs
Outdated
} | ||
|
||
pub fn sing(start: i32, end: i32) -> String { | ||
unimplemented!() | ||
unimplemented!("sing verses {} to {}", start, end) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could specify whether end
is inclusive
exercises/bob/src/lib.rs
Outdated
@@ -1,3 +1,3 @@ | |||
pub fn reply(message: &str) -> &str { | |||
unimplemented!() | |||
unimplemented!("have bob reply to the incoming message: {}", message) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could write Bob not bob
Two notes for this one: 1. We use PhantomData<T> instead of a bare reference to T so that even if the student fails to remove it, things still work. 2. Because the element in push is generic over T, which is not bounded by Debug, we can't emit it in an unimplemented! statement. We therefore fall back on underscore prefixing.
51b9efc
to
1418849
Compare
Closes #484
Includes
_test/check-stubs.sh
, which discovers any compilation errors in the stubs.Eliminates all stub warnings, not just unused variables.
simple-linked-list uses generics which are not bounded by
Debug
, so we can't use the standard "print it inunimplemented!()
trick there. We fall back on underscore-prefixing affected variables in this case.