]> git.lizzy.rs Git - rust.git/commitdiff
Fix comments based on review
authordylni <46035563+dylni@users.noreply.github.com>
Wed, 17 Mar 2021 02:17:49 +0000 (22:17 -0400)
committerdylni <46035563+dylni@users.noreply.github.com>
Wed, 17 Mar 2021 02:17:49 +0000 (22:17 -0400)
library/alloc/src/collections/btree/search.rs

index e599800c3c795a97b601f64ae8f69ea8cab2f775..5dc62d4ec70da16ec636b7d148cc976d17db50f2 100644 (file)
@@ -94,9 +94,8 @@ pub fn search_tree_for_bifurcation<'r, Q: ?Sized, R>(
         K: Borrow<Q>,
         R: RangeBounds<Q>,
     {
-        // It might be unsound to inline these variables if this logic changes (#81138).
-        // We assume the bounds reported by `range` remain the same, but
-        // an adversarial implementation could change between calls
+        // Inlining these variables should be avoided. We assume the bounds reported by `range`
+        // remain the same, but an adversarial implementation could change between calls (#81138).
         let (start, end) = (range.start_bound(), range.end_bound());
         match (start, end) {
             (Bound::Excluded(s), Bound::Excluded(e)) if s == e => {
@@ -114,8 +113,6 @@ pub fn search_tree_for_bifurcation<'r, Q: ?Sized, R>(
         loop {
             let (lower_edge_idx, lower_child_bound) = self.find_lower_bound_index(lower_bound);
             let (upper_edge_idx, upper_child_bound) = self.find_upper_bound_index(upper_bound);
-            // SAFETY: This panic is used for safety, so external impls can't be called here. The
-            // comparison is done with integers for that reason.
             if lower_edge_idx > upper_edge_idx {
                 panic!("Ord is ill-defined in BTreeMap range")
             }