diff options
| author | Kornel <kornel@geekhood.net> | 2024-12-20 17:02:46 +0000 |
|---|---|---|
| committer | Kornel <kornel@geekhood.net> | 2024-12-21 01:26:47 +0000 |
| commit | 7b42bc0c7935e9f5fefd017249041d64f27bb583 (patch) | |
| tree | 5b65fd21829609d725f852c11e141aa59573e349 /library/alloc/src | |
| parent | 5f23ef7d3f7a8c3e0ca5c4e1978829c0448a3686 (diff) | |
| download | rust-7b42bc0c7935e9f5fefd017249041d64f27bb583.tar.gz rust-7b42bc0c7935e9f5fefd017249041d64f27bb583.zip | |
Less unwrap() in documentation
Diffstat (limited to 'library/alloc/src')
| -rw-r--r-- | library/alloc/src/collections/binary_heap/mod.rs | 3 |
1 files changed, 1 insertions, 2 deletions
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<T: Ord, A: Allocator> BinaryHeap<T, A> { /// 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)); |
