-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Remove silence warnings in exercises #391
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
Conversation
Remove unused code warning #71
… into cchiw-patch-11
… into cchiw-patch-11
… into cchiw-patch-11
| #: src/exercises/day-2/health-statistics.md:13 | ||
| msgid "" | ||
| "```rust,should_panic\n" | ||
| "// TODO: remove this when you're done with your implementation.\n" |
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.
Please don't modify the .po files — only the translators can update those.
|
|
||
| impl User { | ||
| pub fn new(name: String, age: u32, weight: f32) -> Self { | ||
| println!("Use name {:?} age {:?} and weight{:?}", name, age, weight); |
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.
I've tried to inline the format strings everywhere else in the course:
| println!("Use name {:?} age {:?} and weight{:?}", name, age, weight); | |
| println!("Use name {name:?} age {age:?} and weight {weight:?}"); |
I also fixed a space, which makes me think that you've not looked at this in the browser after making the change?
| } | ||
|
|
||
| pub fn name(&self) -> &str { | ||
| println!("Use name {:?}", self.name); |
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.
I don't know if we've agreed that this is a good way to "fix" the warnings? I would have added such print statements already if this is a nice way to solve it 🙂
This code had variables in the function arguments that were not being used (yet).
To address that, in this PR I use the function arguments in a print statement. This changes allow us to remove the line to silence warnings for unused variables #71.
Alternatively, we could comment out the functions. As seen in #389.