@@ -2,7 +2,6 @@ use crate::vec::Vec;
2
2
use core:: borrow:: Borrow ;
3
3
use core:: cmp:: Ordering :: { self , Equal , Greater , Less } ;
4
4
use core:: cmp:: { max, min} ;
5
- use core:: error:: Error ;
6
5
use core:: fmt:: { self , Debug } ;
7
6
use core:: hash:: { Hash , Hasher } ;
8
7
use core:: iter:: { FusedIterator , Peekable } ;
@@ -2177,11 +2176,11 @@ impl<'a, T: Ord, A: Allocator + Clone> CursorMut<'a, T, A> {
2177
2176
///
2178
2177
/// If the inserted element is not greater than the element before the
2179
2178
/// cursor (if any), or if it not less than the element after the cursor (if
2180
- /// any), then an [`UnorderedError `] is returned since this would
2179
+ /// any), then an [`UnorderedKeyError `] is returned since this would
2181
2180
/// invalidate the [`Ord`] invariant between the elements of the set.
2182
2181
#[ unstable( feature = "btree_cursors" , issue = "107540" ) ]
2183
- pub fn insert_after ( & mut self , value : T ) -> Result < ( ) , UnorderedError > {
2184
- self . inner . insert_after ( value, SetValZST ) . map_err ( UnorderedError :: from_map_error )
2182
+ pub fn insert_after ( & mut self , value : T ) -> Result < ( ) , UnorderedKeyError > {
2183
+ self . inner . insert_after ( value, SetValZST )
2185
2184
}
2186
2185
2187
2186
/// Inserts a new element into the set in the gap that the
@@ -2192,11 +2191,11 @@ impl<'a, T: Ord, A: Allocator + Clone> CursorMut<'a, T, A> {
2192
2191
///
2193
2192
/// If the inserted element is not greater than the element before the
2194
2193
/// cursor (if any), or if it not less than the element after the cursor (if
2195
- /// any), then an [`UnorderedError `] is returned since this would
2194
+ /// any), then an [`UnorderedKeyError `] is returned since this would
2196
2195
/// invalidate the [`Ord`] invariant between the elements of the set.
2197
2196
#[ unstable( feature = "btree_cursors" , issue = "107540" ) ]
2198
- pub fn insert_before ( & mut self , value : T ) -> Result < ( ) , UnorderedError > {
2199
- self . inner . insert_before ( value, SetValZST ) . map_err ( UnorderedError :: from_map_error )
2197
+ pub fn insert_before ( & mut self , value : T ) -> Result < ( ) , UnorderedKeyError > {
2198
+ self . inner . insert_before ( value, SetValZST )
2200
2199
}
2201
2200
2202
2201
/// Removes the next element from the `BTreeSet`.
@@ -2218,29 +2217,8 @@ impl<'a, T: Ord, A: Allocator + Clone> CursorMut<'a, T, A> {
2218
2217
}
2219
2218
}
2220
2219
2221
- /// Error type returned by [`CursorMut::insert_before`] and
2222
- /// [`CursorMut::insert_after`] if the element being inserted is not properly
2223
- /// ordered with regards to adjacent elements.
2224
- #[ derive( Clone , PartialEq , Eq , Debug ) ]
2225
2220
#[ unstable( feature = "btree_cursors" , issue = "107540" ) ]
2226
- pub struct UnorderedError { }
2227
-
2228
- impl UnorderedError {
2229
- fn from_map_error ( error : super :: map:: UnorderedKeyError ) -> Self {
2230
- let super :: map:: UnorderedKeyError { } = error;
2231
- Self { }
2232
- }
2233
- }
2234
-
2235
- #[ unstable( feature = "btree_cursors" , issue = "107540" ) ]
2236
- impl fmt:: Display for UnorderedError {
2237
- fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
2238
- write ! ( f, "value is not properly ordered relative to neighbors" )
2239
- }
2240
- }
2241
-
2242
- #[ unstable( feature = "btree_cursors" , issue = "107540" ) ]
2243
- impl Error for UnorderedError { }
2221
+ pub use super :: map:: UnorderedKeyError ;
2244
2222
2245
2223
#[ cfg( test) ]
2246
2224
mod tests;
0 commit comments