From 31902e95658ec684294ecabfc577748af193016b Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Thu, 26 Feb 2026 10:29:15 +0100 Subject: [PATCH 1/2] Add Cargo instructions to expression evaluator Our Cargo instructions has not mentioned the `--lib` flag yet, so add it here where it's needed for the first time. --- src/pattern-matching/exercise.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/pattern-matching/exercise.md b/src/pattern-matching/exercise.md index 6384d43a94db..db00679c78e9 100644 --- a/src/pattern-matching/exercise.md +++ b/src/pattern-matching/exercise.md @@ -65,10 +65,17 @@ the course. An expression can be "boxed" with `Box::new` as seen in the tests. To evaluate a boxed expression, use the deref operator (`*`) to "unbox" it: `eval(*boxed_expr)`. -Copy and paste the code into the Rust playground, and begin implementing `eval`. -The final product should pass the tests. It may be helpful to use `todo!()` and -get the tests to pass one-by-one. You can also skip a test temporarily with -`#[ignore]`: +Create a new Cargo library project with + +```sh +cargo new --lib evaluator +``` + +Copy and paste the code below into a the `src/lib.rs` file. + +Then begin implementing `eval`. Use `cargo test` to ensure that the final library +passes the tests. It may be helpful to use `todo!()` and get the tests to pass +one-by-one. You can also skip a test temporarily with `#[ignore]`: ```none #[test] From 418117617c1cf8435e9379ed9efaa0eac1cf1b7f Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Tue, 3 Mar 2026 22:41:58 +0100 Subject: [PATCH 2/2] Apply formatting --- src/pattern-matching/exercise.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pattern-matching/exercise.md b/src/pattern-matching/exercise.md index db00679c78e9..095e3d192bde 100644 --- a/src/pattern-matching/exercise.md +++ b/src/pattern-matching/exercise.md @@ -73,9 +73,9 @@ cargo new --lib evaluator Copy and paste the code below into a the `src/lib.rs` file. -Then begin implementing `eval`. Use `cargo test` to ensure that the final library -passes the tests. It may be helpful to use `todo!()` and get the tests to pass -one-by-one. You can also skip a test temporarily with `#[ignore]`: +Then begin implementing `eval`. Use `cargo test` to ensure that the final +library passes the tests. It may be helpful to use `todo!()` and get the tests +to pass one-by-one. You can also skip a test temporarily with `#[ignore]`: ```none #[test]