diff options
| author | Stein Somers <git@steinsomers.be> | 2020-01-09 12:03:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-01-09 12:03:49 +0100 |
| commit | 9b92bf83156fbe4892fd7a1aa186ce15cce3b770 (patch) | |
| tree | 4a2052f7823e16704144a13ef0727d793e408198 /src/liballoc | |
| parent | 37b5cca3d58413fafdf40aa231bcc5ababaaa0fe (diff) | |
| download | rust-9b92bf83156fbe4892fd7a1aa186ce15cce3b770.tar.gz rust-9b92bf83156fbe4892fd7a1aa186ce15cce3b770.zip | |
Apply suggestions from code review
Co-Authored-By: Ralf Jung <post@ralfj.de>
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/collections/btree/node.rs | 1 | ||||
| -rw-r--r-- | src/liballoc/collections/btree/search.rs | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/liballoc/collections/btree/node.rs b/src/liballoc/collections/btree/node.rs index 03cb54ebce7..f40e0b0c304 100644 --- a/src/liballoc/collections/btree/node.rs +++ b/src/liballoc/collections/btree/node.rs @@ -591,6 +591,7 @@ impl<'a, K: 'a, V: 'a, Type> NodeRef<marker::Mut<'a>, K, V, Type> { unsafe { &mut *(self.root as *mut Root<K, V>) } } + /// The caller must ensure that the node is not the shared root. fn into_key_slice_mut(mut self) -> &'a mut [K] { debug_assert!(!self.is_shared_root()); // We cannot be the shared root, so `as_leaf_mut` is okay. diff --git a/src/liballoc/collections/btree/search.rs b/src/liballoc/collections/btree/search.rs index bdca4d186cf..48cbf67eea2 100644 --- a/src/liballoc/collections/btree/search.rs +++ b/src/liballoc/collections/btree/search.rs @@ -62,7 +62,7 @@ where // This function is defined over all borrow types (immutable, mutable, owned), // and may be called on the shared root in each case. // Crucially, we use `keys()` here, i.e., we work with immutable data. - // We do not need to make `keys_mut()` public and require support for the shared root. + // `keys_mut()` does not support the shared root, so we cannot use it. // Using `keys()` is fine here even if BorrowType is mutable, as all we return // is an index -- not a reference. for (i, k) in node.keys().iter().enumerate() { |
