Skip to content

Finish exercises refactor: rename, restructure, and fix all examples#1

Open
mre wants to merge 1 commit into
mainfrom
finish-exercises-refactor
Open

Finish exercises refactor: rename, restructure, and fix all examples#1
mre wants to merge 1 commit into
mainfrom
finish-exercises-refactor

Conversation

@mre
Copy link
Copy Markdown
Member

@mre mre commented May 7, 2026

Completes the in-progress reshuffle of the exercise track to the 19-exercise progression documented in the README (00–18).

Renames / new files

  • Renumber and rename exercises so file names match the README progression
    (e.g. 01_integer_handling02_numbers_and_math, 11_password_validator
    12_password_validator, 12_question_mark_operator13_question_mark_operator,
    15_rust_fundamentals_quiz16_quiz, etc.).
  • New foundation exercises: 01_basic_types, 03_strings_and_text,
    04_collections_basics, 08_ownership_and_borrowing, 10_enums_and_matching.

Make every example compile cleanly

  • 00_hello_rust: add #[cfg(test)] + use super::*; fix four lines accidentally
    written as ///! (outer doc comment) instead of //! (inner module docs).
  • 0104 (foundation): add missing #[cfg(test)] on mod tests and gate bonus
    modules with #[cfg(all(test, feature = "bonus"))] so they participate in
    the test build instead of being silently skipped.
  • 05_tuples_and_structs: mark bonus functions pub and reach them from
    bonus_tests via super::super::bonus so the bonus build compiles.
  • 06_option_and_some_none: add explicit lifetime to find_user_by_id.
  • 08_ownership_and_borrowing: add explicit lifetime to find_longest_word.
  • 13_question_mark_operator: stop comparing Result<_, io::Error> /
    Result<_, Box<dyn Error>> with assert_eq!; unwrap() and compare values.
  • 15_modules: rewrite so the modules expose a real pub API and the wrapper
    functions are todo!() placeholders the student fills in.

Cargo / server cleanup

  • Cargo.toml: fix stale [package.metadata.exercises.12_question_mark_operator]
    key (now 13_question_mark_operator).
  • src/bin/server.rs: silence two dead_code warnings on DbParticipant /
    DbSubmission with #[allow(dead_code)] (sqlx::FromRow needs the fields).

Repo hygiene

  • .gitignore: ignore local TODO/ scratch directory so planning notes stay
    out of the tree.

Verification

  • cargo test --example XX --no-run is green for all 19 exercises.
  • cargo test --example XX --features bonus --no-run is green for all 19.
  • cargo build --bin server is warning-free.

Complete the in-progress reshuffle of the exercise track to the 19-exercise
progression documented in the README (00-18).

Renames / new files
- Renumber and rename exercises so file names match the README progression
  (e.g. 01_integer_handling -> 02_numbers_and_math, 11_password_validator ->
  12_password_validator, 12_question_mark_operator -> 13_question_mark_operator,
  15_rust_fundamentals_quiz -> 16_quiz, etc.).
- New foundation exercises: 01_basic_types, 03_strings_and_text,
  04_collections_basics, 08_ownership_and_borrowing, 10_enums_and_matching.

Make every example compile cleanly
- 00_hello_rust: add #[cfg(test)] + use super::*; fix four lines accidentally
  written as ///! (outer doc comment) instead of //! (inner module docs).
- 01-04 (foundation): add missing #[cfg(test)] on mod tests and gate bonus
  modules with #[cfg(all(test, feature = "bonus"))] so they participate in
  the test build instead of being silently skipped.
- 05_tuples_and_structs: mark bonus functions pub and reach them from
  bonus_tests via super::super::bonus so the bonus build compiles.
- 06_option_and_some_none: add explicit lifetime to find_user_by_id.
- 08_ownership_and_borrowing: add explicit lifetime to find_longest_word.
- 13_question_mark_operator: stop comparing Result<_, io::Error> /
  Result<_, Box<dyn Error>> with assert_eq!; unwrap and compare values.
- 15_modules: rewrite so the modules expose a real pub API and the wrapper
  functions are todo!() placeholders the student fills in.

Cargo / server cleanup
- Cargo.toml: fix stale [package.metadata.exercises.12_question_mark_operator]
  key (now 13_question_mark_operator).
- src/bin/server.rs: silence two dead_code warnings on DbParticipant /
  DbSubmission with #[allow(dead_code)] (sqlx::FromRow needs the fields).

Repo hygiene
- .gitignore: ignore local TODO/ scratch directory so planning notes stay
  out of the tree.

Verification
- cargo test --example XX --no-run is green for all 19 exercises.
- cargo test --example XX --features bonus --no-run is green for all 19.
- cargo build --bin server is warning-free.
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

Successfully merging this pull request may close these issues.

1 participant