@@ -46,7 +46,7 @@ impl RoaringTreemap {
46
46
/// ```
47
47
pub fn insert ( & mut self , value : u64 ) -> bool {
48
48
let ( hi, lo) = util:: split ( value) ;
49
- self . map . entry ( hi) . or_insert_with ( RoaringBitmap :: new ) . insert ( lo)
49
+ self . map . entry ( hi) . or_default ( ) . insert ( lo)
50
50
}
51
51
52
52
/// Inserts a range of values.
@@ -81,11 +81,11 @@ impl RoaringTreemap {
81
81
82
82
// Calculate the sub-range from the lower 32 bits
83
83
counter += if hi == end_hi && hi == start_hi {
84
- entry. or_insert_with ( RoaringBitmap :: new ) . insert_range ( start_lo..=end_lo)
84
+ entry. or_default ( ) . insert_range ( start_lo..=end_lo)
85
85
} else if hi == start_hi {
86
- entry. or_insert_with ( RoaringBitmap :: new ) . insert_range ( start_lo..=u32:: MAX )
86
+ entry. or_default ( ) . insert_range ( start_lo..=u32:: MAX )
87
87
} else if hi == end_hi {
88
- entry. or_insert_with ( RoaringBitmap :: new ) . insert_range ( 0 ..=end_lo)
88
+ entry. or_default ( ) . insert_range ( 0 ..=end_lo)
89
89
} else {
90
90
// We insert a full bitmap if it doesn't already exist and return the size of it.
91
91
// But if the bitmap already exists at this spot we replace it with a full bitmap
@@ -122,7 +122,7 @@ impl RoaringTreemap {
122
122
/// ```
123
123
pub fn push ( & mut self , value : u64 ) -> bool {
124
124
let ( hi, lo) = util:: split ( value) ;
125
- self . map . entry ( hi) . or_insert_with ( RoaringBitmap :: new ) . push ( lo)
125
+ self . map . entry ( hi) . or_default ( ) . push ( lo)
126
126
}
127
127
128
128
/// Pushes `value` in the treemap only if it is greater than the current maximum value.
0 commit comments