From 64f7e0351b8a22f6f414913091e9214ef65c0703 Mon Sep 17 00:00:00 2001 From: Jaehwang Jung Date: Sat, 16 Sep 2023 17:06:52 +0900 Subject: [PATCH] update 04d88472ccab31310efc5ea3af2fd0fe7f0973e0 Co-authored-by: Woogie Jeon <34697855+33577@users.noreply.github.com> --- homework/doc/arc.md | 4 ++-- homework/doc/hash_table.md | 2 +- homework/doc/hello_server.md | 2 +- homework/tests/arc.rs | 3 --- homework/tests/list_set/optimistic_fine_grained.rs | 2 +- 5 files changed, 5 insertions(+), 8 deletions(-) diff --git a/homework/doc/arc.md b/homework/doc/arc.md index 2b05b95626f..4bad3e80ee2 100644 --- a/homework/doc/arc.md +++ b/homework/doc/arc.md @@ -17,12 +17,12 @@ because that version is more complex. Follow [the Arc section of the Rustnomicon (the book on unsafe Rust)][nomicon-arc]. Some food for thought on Rustnomicon's description: -* Quiz: why does `Arc : Sync` require `T : Send`? +* Quiz: Why does `Arc : Sync` require `T : Send`? * The [Layout section](https://doc.rust-lang.org/nomicon/arc-mutex/arc-layout.html) explains why [`NonNull`](https://doc.rust-lang.org/std/ptr/struct.NonNull.html) and `PhantomData` are necessary. We don't care about them in this course and will not ask about them in the exams (it's quite interesting, though). -* Their implementation uses `fence(Acquire)`, which we didn't cover in the lecture. +* Their implementation uses `fence(Acquire)`, which we may not be able cover in the lecture due to time constraints. You can implement (a slightly inefficient version of) Arc only with `AtomicUsize`'s methods and the concepts we covered in the lecture (you will need to use `Ordering::AcqRel` in some places). Using `fence(Acquire)` is not required in the homework and exam. diff --git a/homework/doc/hash_table.md b/homework/doc/hash_table.md index a961d2470fb..8a330d9523b 100644 --- a/homework/doc/hash_table.md +++ b/homework/doc/hash_table.md @@ -37,7 +37,7 @@ Use release-acquire synchronization for atomic accesses, just like many other da ## Testing -Tests in `tests/{growable_array,hash_table}.rs` use the map test functions defined in `tests/map/mod.rs`. +Tests in `tests/{growable_array,hash_table}.rs` use the map test functions defined in `src/test/adt/map.rs`. * `smoke`: Simple test case that tries a few operations. Useful for debugging. * `stress_sequential`: diff --git a/homework/doc/hello_server.md b/homework/doc/hello_server.md index f25c713f4f8..3a74dcff582 100644 --- a/homework/doc/hello_server.md +++ b/homework/doc/hello_server.md @@ -14,7 +14,7 @@ - `../src/hello_server/*.rs`: the server components. You should fill out `todo!()` in those files. ## Grading -The grader runs `./script/grade-hello_server.sh` in the `homework` directory. +The grader runs `./scripts/grade-hello_server.sh` in the `homework` directory. This script runs the tests with various options. There will be no partial scores for each module. diff --git a/homework/tests/arc.rs b/homework/tests/arc.rs index d436ca0abd4..1faf59d477f 100644 --- a/homework/tests/arc.rs +++ b/homework/tests/arc.rs @@ -64,7 +64,6 @@ mod basic { } #[test] - #[allow(clippy::redundant_clone)] fn test_cowarc_clone_unique2() { let mut cow0 = Arc::new(75); let cow1 = cow0.clone(); @@ -97,7 +96,6 @@ mod basic { } #[test] - #[allow(clippy::redundant_clone)] fn test_count() { let a = Arc::new(0); assert!(Arc::count(&a) == 1); @@ -107,7 +105,6 @@ mod basic { } #[test] - #[allow(clippy::redundant_clone)] fn test_ptr_eq() { let five = Arc::new(5); let same_five = five.clone(); diff --git a/homework/tests/list_set/optimistic_fine_grained.rs b/homework/tests/list_set/optimistic_fine_grained.rs index e469621250e..716b9a84a2a 100644 --- a/homework/tests/list_set/optimistic_fine_grained.rs +++ b/homework/tests/list_set/optimistic_fine_grained.rs @@ -129,7 +129,7 @@ fn iter_consistent() { } // sorted assert!(snapshot.windows(2).all(|k| k[0] <= k[1])); - let max = snapshot.last().map(|&x| x).unwrap_or(0); + let max = snapshot.last().copied().unwrap_or(0); let evens = evens .iter() .copied()