From 564503c4c8723f25c46e3bcd9cb6bfc854c7750d Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Sat, 28 Nov 2026 02:50:56 -0500 Subject: [PATCH] refactor(ch01): flatten crate layout to use src/bin - Remove nested 01-introduction-to-rust/mylib/ crate and obsolete .gitignore entry - Initialize ch01_intro_rust package directly in 01-introduction-to-rust/ - Move listings.rs into src/bin/ so Cargo builds binaries into target/ --- .gitignore | 1 - 01-introduction-to-rust/Cargo.lock | 7 +++++++ 01-introduction-to-rust/{mylib => }/Cargo.toml | 2 +- 01-introduction-to-rust/mylib/src/lib.rs | 14 -------------- .../{mylib/src => src/bin}/listings.rs | 0 5 files changed, 8 insertions(+), 16 deletions(-) create mode 100644 01-introduction-to-rust/Cargo.lock rename 01-introduction-to-rust/{mylib => }/Cargo.toml (70%) delete mode 100644 01-introduction-to-rust/mylib/src/lib.rs rename 01-introduction-to-rust/{mylib/src => src/bin}/listings.rs (100%) diff --git a/.gitignore b/.gitignore index 3cb0f9c..6fcab73 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ # Rust build artifacts & ad-hoc rustc binaries target/ **/*.rs.bk -01-introduction-to-rust/mylib/src/listings diff --git a/01-introduction-to-rust/Cargo.lock b/01-introduction-to-rust/Cargo.lock new file mode 100644 index 0000000..289e92a --- /dev/null +++ b/01-introduction-to-rust/Cargo.lock @@ -0,0 +1,7 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "ch01_intro_rust" +version = "0.1.0" diff --git a/01-introduction-to-rust/mylib/Cargo.toml b/01-introduction-to-rust/Cargo.toml similarity index 70% rename from 01-introduction-to-rust/mylib/Cargo.toml rename to 01-introduction-to-rust/Cargo.toml index bf0d4b1..3f15449 100644 --- a/01-introduction-to-rust/mylib/Cargo.toml +++ b/01-introduction-to-rust/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "mylib" +name = "ch01_intro_rust" version = "0.1.0" edition = "2024" diff --git a/01-introduction-to-rust/mylib/src/lib.rs b/01-introduction-to-rust/mylib/src/lib.rs deleted file mode 100644 index b93cf3f..0000000 --- a/01-introduction-to-rust/mylib/src/lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub fn add(left: u64, right: u64) -> u64 { - left + right -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn it_works() { - let result = add(2, 2); - assert_eq!(result, 4); - } -} diff --git a/01-introduction-to-rust/mylib/src/listings.rs b/01-introduction-to-rust/src/bin/listings.rs similarity index 100% rename from 01-introduction-to-rust/mylib/src/listings.rs rename to 01-introduction-to-rust/src/bin/listings.rs