diff --git a/src/user-defined-types/exercise.md b/src/user-defined-types/exercise.md index 4377ceb3..524d258b 100644 --- a/src/user-defined-types/exercise.md +++ b/src/user-defined-types/exercise.md @@ -41,3 +41,13 @@ out of these structures. {{#include exercise.rs:main}} ``` + +
+ +- 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. + +
diff --git a/src/user-defined-types/exercise.rs b/src/user-defined-types/exercise.rs index d8041993..6aced372 100644 --- a/src/user-defined-types/exercise.rs +++ b/src/user-defined-types/exercise.rs @@ -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 {