Skip to content

Commit

Permalink
Suppress warnings for elevator exercise (#2668)
Browse files Browse the repository at this point in the history
  • Loading branch information
randomPoison authored Feb 27, 2025
1 parent 8b04a6d commit 5ab6fae
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/user-defined-types/exercise.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,13 @@ out of these structures.
{{#include exercise.rs:main}}
```

<details>

- If students ask about `#![allow(dead_code)]` at the top of the exercise, it's
necessary because the only thing we do with the `Event` type is print it out.
Due to a nuance of how the compiler checks for dead code this causes it to
think that the code is unused. They can ignore it for the purpose of this
exercise.

</details>
4 changes: 2 additions & 2 deletions src/user-defined-types/exercise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#![allow(dead_code)]

// ANCHOR: solution
// ANCHOR: event
#![allow(dead_code)]

#[derive(Debug)]
/// An event in the elevator system that the controller must react to.
enum Event {
Expand Down

0 comments on commit 5ab6fae

Please sign in to comment.