Skip to content

Commit 556a319

Browse files
timviseegitbot
authored and
gitbot
committed
Also use zero when referencing to capacity or length
1 parent 9b57eb4 commit 556a319

File tree

6 files changed

+28
-28
lines changed

6 files changed

+28
-28
lines changed

alloc/src/collections/binary_heap/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ impl<T: Ord> BinaryHeap<T> {
452452
///
453453
/// The binary heap will be able to hold at least `capacity` elements without
454454
/// reallocating. This method is allowed to allocate for more elements than
455-
/// `capacity`. If `capacity` is 0, the binary heap will not allocate.
455+
/// `capacity`. If `capacity` is zero, the binary heap will not allocate.
456456
///
457457
/// # Examples
458458
///
@@ -496,7 +496,7 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
496496
///
497497
/// The binary heap will be able to hold at least `capacity` elements without
498498
/// reallocating. This method is allowed to allocate for more elements than
499-
/// `capacity`. If `capacity` is 0, the binary heap will not allocate.
499+
/// `capacity`. If `capacity` is zero, the binary heap will not allocate.
500500
///
501501
/// # Examples
502502
///

alloc/src/vec/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ impl<T> Vec<T> {
427427
///
428428
/// The vector will be able to hold at least `capacity` elements without
429429
/// reallocating. This method is allowed to allocate for more elements than
430-
/// `capacity`. If `capacity` is 0, the vector will not allocate.
430+
/// `capacity`. If `capacity` is zero, the vector will not allocate.
431431
///
432432
/// It is important to note that although the returned vector has the
433433
/// minimum *capacity* specified, the vector will have a zero *length*. For
@@ -487,7 +487,7 @@ impl<T> Vec<T> {
487487
///
488488
/// The vector will be able to hold at least `capacity` elements without
489489
/// reallocating. This method is allowed to allocate for more elements than
490-
/// `capacity`. If `capacity` is 0, the vector will not allocate.
490+
/// `capacity`. If `capacity` is zero, the vector will not allocate.
491491
///
492492
/// # Errors
493493
///
@@ -745,7 +745,7 @@ impl<T, A: Allocator> Vec<T, A> {
745745
///
746746
/// The vector will be able to hold at least `capacity` elements without
747747
/// reallocating. This method is allowed to allocate for more elements than
748-
/// `capacity`. If `capacity` is 0, the vector will not allocate.
748+
/// `capacity`. If `capacity` is zero, the vector will not allocate.
749749
///
750750
/// It is important to note that although the returned vector has the
751751
/// minimum *capacity* specified, the vector will have a zero *length*. For
@@ -808,7 +808,7 @@ impl<T, A: Allocator> Vec<T, A> {
808808
///
809809
/// The vector will be able to hold at least `capacity` elements without
810810
/// reallocating. This method is allowed to allocate for more elements than
811-
/// `capacity`. If `capacity` is 0, the vector will not allocate.
811+
/// `capacity`. If `capacity` is zero, the vector will not allocate.
812812
///
813813
/// # Errors
814814
///

core/src/iter/traits/iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1553,7 +1553,7 @@ pub trait Iterator {
15531553
///
15541554
/// # Panics
15551555
///
1556-
/// Panics if `N` is 0. This check will most probably get changed to a
1556+
/// Panics if `N` is zero. This check will most probably get changed to a
15571557
/// compile time error before this method gets stabilized.
15581558
///
15591559
/// ```should_panic
@@ -3454,7 +3454,7 @@ pub trait Iterator {
34543454
///
34553455
/// # Panics
34563456
///
3457-
/// Panics if `N` is 0.
3457+
/// Panics if `N` is zero.
34583458
///
34593459
/// # Examples
34603460
///

core/src/slice/mod.rs

+16-16
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ impl<T> [T] {
10391039
///
10401040
/// # Panics
10411041
///
1042-
/// Panics if `size` is 0.
1042+
/// Panics if `size` is zero.
10431043
///
10441044
/// # Examples
10451045
///
@@ -1095,7 +1095,7 @@ impl<T> [T] {
10951095
///
10961096
/// # Panics
10971097
///
1098-
/// Panics if `chunk_size` is 0.
1098+
/// Panics if `chunk_size` is zero.
10991099
///
11001100
/// # Examples
11011101
///
@@ -1130,7 +1130,7 @@ impl<T> [T] {
11301130
///
11311131
/// # Panics
11321132
///
1133-
/// Panics if `chunk_size` is 0.
1133+
/// Panics if `chunk_size` is zero.
11341134
///
11351135
/// # Examples
11361136
///
@@ -1172,7 +1172,7 @@ impl<T> [T] {
11721172
///
11731173
/// # Panics
11741174
///
1175-
/// Panics if `chunk_size` is 0.
1175+
/// Panics if `chunk_size` is zero.
11761176
///
11771177
/// # Examples
11781178
///
@@ -1211,7 +1211,7 @@ impl<T> [T] {
12111211
///
12121212
/// # Panics
12131213
///
1214-
/// Panics if `chunk_size` is 0.
1214+
/// Panics if `chunk_size` is zero.
12151215
///
12161216
/// # Examples
12171217
///
@@ -1288,7 +1288,7 @@ impl<T> [T] {
12881288
///
12891289
/// # Panics
12901290
///
1291-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1291+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
12921292
/// error before this method gets stabilized.
12931293
///
12941294
/// # Examples
@@ -1334,7 +1334,7 @@ impl<T> [T] {
13341334
///
13351335
/// # Panics
13361336
///
1337-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1337+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
13381338
/// error before this method gets stabilized.
13391339
///
13401340
/// # Examples
@@ -1372,7 +1372,7 @@ impl<T> [T] {
13721372
///
13731373
/// # Panics
13741374
///
1375-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1375+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
13761376
/// error before this method gets stabilized.
13771377
///
13781378
/// # Examples
@@ -1448,7 +1448,7 @@ impl<T> [T] {
14481448
///
14491449
/// # Panics
14501450
///
1451-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1451+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
14521452
/// error before this method gets stabilized.
14531453
///
14541454
/// # Examples
@@ -1489,7 +1489,7 @@ impl<T> [T] {
14891489
///
14901490
/// # Panics
14911491
///
1492-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1492+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
14931493
/// error before this method gets stabilized.
14941494
///
14951495
/// # Examples
@@ -1533,7 +1533,7 @@ impl<T> [T] {
15331533
///
15341534
/// # Panics
15351535
///
1536-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1536+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
15371537
/// error before this method gets stabilized.
15381538
///
15391539
/// # Examples
@@ -1568,7 +1568,7 @@ impl<T> [T] {
15681568
///
15691569
/// # Panics
15701570
///
1571-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1571+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
15721572
/// error before this method gets stabilized.
15731573
///
15741574
/// # Examples
@@ -1604,7 +1604,7 @@ impl<T> [T] {
16041604
///
16051605
/// # Panics
16061606
///
1607-
/// Panics if `chunk_size` is 0.
1607+
/// Panics if `chunk_size` is zero.
16081608
///
16091609
/// # Examples
16101610
///
@@ -1639,7 +1639,7 @@ impl<T> [T] {
16391639
///
16401640
/// # Panics
16411641
///
1642-
/// Panics if `chunk_size` is 0.
1642+
/// Panics if `chunk_size` is zero.
16431643
///
16441644
/// # Examples
16451645
///
@@ -1682,7 +1682,7 @@ impl<T> [T] {
16821682
///
16831683
/// # Panics
16841684
///
1685-
/// Panics if `chunk_size` is 0.
1685+
/// Panics if `chunk_size` is zero.
16861686
///
16871687
/// # Examples
16881688
///
@@ -1722,7 +1722,7 @@ impl<T> [T] {
17221722
///
17231723
/// # Panics
17241724
///
1725-
/// Panics if `chunk_size` is 0.
1725+
/// Panics if `chunk_size` is zero.
17261726
///
17271727
/// # Examples
17281728
///

std/src/collections/hash/map.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl<K, V> HashMap<K, V, RandomState> {
235235
///
236236
/// The hash map will be able to hold at least `capacity` elements without
237237
/// reallocating. This method is allowed to allocate for more elements than
238-
/// `capacity`. If `capacity` is 0, the hash map will not allocate.
238+
/// `capacity`. If `capacity` is zero, the hash map will not allocate.
239239
///
240240
/// # Examples
241241
///
@@ -287,7 +287,7 @@ impl<K, V, S> HashMap<K, V, S> {
287287
///
288288
/// The hash map will be able to hold at least `capacity` elements without
289289
/// reallocating. This method is allowed to allocate for more elements than
290-
/// `capacity`. If `capacity` is 0, the hash map will not allocate.
290+
/// `capacity`. If `capacity` is zero, the hash map will not allocate.
291291
///
292292
/// Warning: `hasher` is normally randomly generated, and
293293
/// is designed to allow HashMaps to be resistant to attacks that

std/src/collections/hash/set.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ impl<T> HashSet<T, RandomState> {
130130
///
131131
/// The hash set will be able to hold at least `capacity` elements without
132132
/// reallocating. This method is allowed to allocate for more elements than
133-
/// `capacity`. If `capacity` is 0, the hash set will not allocate.
133+
/// `capacity`. If `capacity` is zero, the hash set will not allocate.
134134
///
135135
/// # Examples
136136
///
@@ -379,7 +379,7 @@ impl<T, S> HashSet<T, S> {
379379
///
380380
/// The hash set will be able to hold at least `capacity` elements without
381381
/// reallocating. This method is allowed to allocate for more elements than
382-
/// `capacity`. If `capacity` is 0, the hash set will not allocate.
382+
/// `capacity`. If `capacity` is zero, the hash set will not allocate.
383383
///
384384
/// Warning: `hasher` is normally randomly generated, and
385385
/// is designed to allow `HashSet`s to be resistant to attacks that

0 commit comments

Comments
 (0)