From 7b42bc0c7935e9f5fefd017249041d64f27bb583 Mon Sep 17 00:00:00 2001 From: Kornel Date: Fri, 20 Dec 2024 17:02:46 +0000 Subject: Less unwrap() in documentation --- library/alloc/src/collections/binary_heap/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'library/alloc/src') diff --git a/library/alloc/src/collections/binary_heap/mod.rs b/library/alloc/src/collections/binary_heap/mod.rs index 116e0e73e96..965fd63a529 100644 --- a/library/alloc/src/collections/binary_heap/mod.rs +++ b/library/alloc/src/collections/binary_heap/mod.rs @@ -531,8 +531,7 @@ impl BinaryHeap { /// heap.push(1); /// heap.push(5); /// heap.push(2); - /// { - /// let mut val = heap.peek_mut().unwrap(); + /// if let Some(mut val) = heap.peek_mut() { /// *val = 0; /// } /// assert_eq!(heap.peek(), Some(&2)); -- cgit 1.4.1-3-g733a5