Skip to content

Commit 6dcac64

Browse files
committed
Missed another mut: contains_range doesn't require &mut
1 parent b7d3d8c commit 6dcac64

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

croaring/src/bitmap/imp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,18 @@ impl Bitmap {
202202
/// ```
203203
/// use croaring::Bitmap;
204204
///
205-
/// let mut bitmap = Bitmap::create();
206-
/// bitmap.add_range((1..3));
205+
/// let bitmap = Bitmap::of(&[1, 2]);
207206
/// assert!(bitmap.contains_range((1..3)));
208207
///
208+
/// let mut bitmap = bitmap.clone();
209209
/// bitmap.add(u32::MAX - 1);
210210
/// bitmap.add(u32::MAX);
211211
/// assert!(bitmap.contains_range((u32::MAX - 1)..=u32::MAX))
212212
/// ```
213213
#[inline]
214-
pub fn contains_range<R: RangeBounds<u32>>(&mut self, range: R) -> bool {
214+
pub fn contains_range<R: RangeBounds<u32>>(&self, range: R) -> bool {
215215
let (start, end) = range_to_exclusive(range);
216-
unsafe { ffi::roaring_bitmap_contains_range(&mut self.bitmap, start, end) }
216+
unsafe { ffi::roaring_bitmap_contains_range(&self.bitmap, start, end) }
217217
}
218218

219219
/// Empties the bitmap

croaring/src/bitmap/ops.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ impl<'a> BitAnd<&'a Bitmap> for Bitmap {
133133
/// ```
134134
#[inline]
135135
fn bitand(self, other: &'a Bitmap) -> Bitmap {
136-
self.and(&other)
136+
self.and(other)
137137
}
138138
}
139139

@@ -161,7 +161,7 @@ impl<'a, 'b> BitAnd<&'a Bitmap> for &'b Bitmap {
161161
/// ```
162162
#[inline]
163163
fn bitand(self, other: &'a Bitmap) -> Bitmap {
164-
self.and(&other)
164+
self.and(other)
165165
}
166166
}
167167

@@ -256,7 +256,7 @@ impl<'a> BitOr<&'a Bitmap> for Bitmap {
256256
/// ```
257257
#[inline]
258258
fn bitor(self, other: &'a Bitmap) -> Bitmap {
259-
self.or(&other)
259+
self.or(other)
260260
}
261261
}
262262

@@ -284,7 +284,7 @@ impl<'a, 'b> BitOr<&'a Bitmap> for &'b Bitmap {
284284
/// ```
285285
#[inline]
286286
fn bitor(self, other: &'a Bitmap) -> Bitmap {
287-
self.or(&other)
287+
self.or(other)
288288
}
289289
}
290290

@@ -372,7 +372,7 @@ impl<'a> BitXor<&'a Bitmap> for Bitmap {
372372
/// ```
373373
#[inline]
374374
fn bitxor(self, other: &'a Bitmap) -> Bitmap {
375-
self.xor(&other)
375+
self.xor(other)
376376
}
377377
}
378378

@@ -403,7 +403,7 @@ impl<'a, 'b> BitXor<&'a Bitmap> for &'b Bitmap {
403403
/// ```
404404
#[inline]
405405
fn bitxor(self, other: &'a Bitmap) -> Bitmap {
406-
self.xor(&other)
406+
self.xor(other)
407407
}
408408
}
409409

@@ -498,7 +498,7 @@ impl<'a> Sub<&'a Bitmap> for Bitmap {
498498
/// ```
499499
#[inline]
500500
fn sub(self, other: &'a Bitmap) -> Bitmap {
501-
self.andnot(&other)
501+
self.andnot(other)
502502
}
503503
}
504504

@@ -531,7 +531,7 @@ impl<'a, 'b> Sub<&'a Bitmap> for &'b Bitmap {
531531
/// ```
532532
#[inline]
533533
fn sub(self, other: &'a Bitmap) -> Bitmap {
534-
self.andnot(&other)
534+
self.andnot(other)
535535
}
536536
}
537537

croaring/src/treemap/imp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ impl Treemap {
223223
for (key, bitmap) in &self.map {
224224
other
225225
.map
226-
.get(&key)
226+
.get(key)
227227
.map(|other_bitmap| treemap.map.insert(*key, bitmap.and(other_bitmap)));
228228
}
229229

croaring/src/treemap/ops.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ impl<'a> BitAnd<&'a Treemap> for Treemap {
7878
/// ```
7979
#[inline]
8080
fn bitand(self, other: &'a Treemap) -> Treemap {
81-
self.and(&other)
81+
self.and(other)
8282
}
8383
}
8484

@@ -106,7 +106,7 @@ impl<'a, 'b> BitAnd<&'a Treemap> for &'b Treemap {
106106
/// ```
107107
#[inline]
108108
fn bitand(self, other: &'a Treemap) -> Treemap {
109-
self.and(&other)
109+
self.and(other)
110110
}
111111
}
112112

@@ -201,7 +201,7 @@ impl<'a> BitOr<&'a Treemap> for Treemap {
201201
/// ```
202202
#[inline]
203203
fn bitor(self, other: &'a Treemap) -> Treemap {
204-
self.or(&other)
204+
self.or(other)
205205
}
206206
}
207207

@@ -229,7 +229,7 @@ impl<'a, 'b> BitOr<&'a Treemap> for &'b Treemap {
229229
/// ```
230230
#[inline]
231231
fn bitor(self, other: &'a Treemap) -> Treemap {
232-
self.or(&other)
232+
self.or(other)
233233
}
234234
}
235235

@@ -319,7 +319,7 @@ impl<'a> BitXor<&'a Treemap> for Treemap {
319319
/// ```
320320
#[inline]
321321
fn bitxor(self, other: &'a Treemap) -> Treemap {
322-
self.xor(&other)
322+
self.xor(other)
323323
}
324324
}
325325

@@ -351,7 +351,7 @@ impl<'a, 'b> BitXor<&'a Treemap> for &'b Treemap {
351351
/// ```
352352
#[inline]
353353
fn bitxor(self, other: &'a Treemap) -> Treemap {
354-
self.xor(&other)
354+
self.xor(other)
355355
}
356356
}
357357

@@ -449,7 +449,7 @@ impl<'a> Sub<&'a Treemap> for Treemap {
449449
/// ```
450450
#[inline]
451451
fn sub(self, other: &'a Treemap) -> Treemap {
452-
self.andnot(&other)
452+
self.andnot(other)
453453
}
454454
}
455455

@@ -483,7 +483,7 @@ impl<'a, 'b> Sub<&'a Treemap> for &'b Treemap {
483483
/// ```
484484
#[inline]
485485
fn sub(self, other: &'a Treemap) -> Treemap {
486-
self.andnot(&other)
486+
self.andnot(other)
487487
}
488488
}
489489

0 commit comments

Comments
 (0)