From 699b03d2f0accbd6ee8d55eaedec3e489c91af51 Mon Sep 17 00:00:00 2001 From: Xu Shaohua Date: Thu, 14 Dec 2023 16:06:16 +0800 Subject: [PATCH] ds: Enlarge items in linked list to test drop recursively --- data_structures/src/list/single_v1.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/data_structures/src/list/single_v1.rs b/data_structures/src/list/single_v1.rs index 7219bc3c..17a27a8a 100644 --- a/data_structures/src/list/single_v1.rs +++ b/data_structures/src/list/single_v1.rs @@ -85,13 +85,13 @@ impl LinkedListV1 { /// Insert the value at specific position in list. /// /// Time is O(n). - pub fn insert_at(&mut self, _value: &T, pos: usize) { - debug_assert!(pos < self.length); + pub fn insert_at(&mut self, _value: T, _pos: usize) -> Option { + unimplemented!() } /// Remove a node at position. - pub fn remove_at(&mut self, pos: usize) { - debug_assert!(pos < self.length); + pub fn remove_at(&mut self, _pos: usize) -> Option { + unimplemented!() } /// Get head node in list. @@ -156,8 +156,7 @@ where /// Returns position of value in list. /// /// Returns None if not found. - pub fn find(&self, _value: &T) -> &ListNodePtr { - // TODO(Shaohua): Returns a reference + pub fn find(&self, _value: &T) -> Option { unimplemented!() } @@ -243,7 +242,7 @@ mod tests { // The default recursive limit rustc-v1.74 is 128. // See https://doc.rust-lang.org/reference/attributes/limits.html let mut list = LinkedListV1::new(); - for i in 0..(128 * 8) { + for i in 0..(128 * 200) { list.push(i); } drop(list);