Skip to content
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

Consider Adding #[allow(dead_code)] To Examples #226

Open
JimLynchCodes opened this issue Dec 2, 2024 · 0 comments
Open

Consider Adding #[allow(dead_code)] To Examples #226

JimLynchCodes opened this issue Dec 2, 2024 · 0 comments

Comments

@JimLynchCodes
Copy link

JimLynchCodes commented Dec 2, 2024

These examples are great, but when the student successfully completes the exercise there are still a bunch of warnings in the output.

eg:

02_match   test   pass!    2 warnings   

 1  warning: enum `Shape` is never used
  --> exercises/05_ticket_v2/02_match/src/lib.rs:2:6
   |
 2 | enum Shape {
   |      ^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
 
 2  warning: method `n_sides` is never used
   --> exercises/05_ticket_v2/02_match/src/lib.rs:13:12
    |
 10 | impl Shape {
    | ---------- method in this implementation
 ...
 13 |     pub fn n_sides(&self) -> u8 {
    |            ^^^^^^^

Consider annotating the Shape enum and n_sides functions here with the attribute macro #[allow(dead_code)] so that the output is green and lovely:

 02_match   test   pass!  
                                                                                       ▐
running 5 tests                                                                        ▐
test tests::test_circle ... ok                                                         ▐
test tests::test_pentagon ... ok                                                       ▐
test tests::test_rectangle ... ok                                                      ▐
test tests::test_square ... ok                                                         ▐
test tests::test_triangle ... ok                                                       ▐
                                                                                       ▐
test result: ok. 5 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished i ▐
n 0.00s                                                                                ▐
                                                                                       ▐
   Doc-tests match_

running 0 tests

I can help with this if you decide you want to update all the examples to include this. 👍

Or even better, maybe there is a way to add it to one overall Cargo.toml file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant