Skip to content

Commit 97c6470

Browse files
timviseegitbot
authored and
gitbot
committed
Also use zero when referencing to capacity or length
1 parent e8a17e2 commit 97c6470

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
@@ -1077,7 +1077,7 @@ impl<T> [T] {
10771077
///
10781078
/// # Panics
10791079
///
1080-
/// Panics if `size` is 0.
1080+
/// Panics if `size` is zero.
10811081
///
10821082
/// # Examples
10831083
///
@@ -1133,7 +1133,7 @@ impl<T> [T] {
11331133
///
11341134
/// # Panics
11351135
///
1136-
/// Panics if `chunk_size` is 0.
1136+
/// Panics if `chunk_size` is zero.
11371137
///
11381138
/// # Examples
11391139
///
@@ -1168,7 +1168,7 @@ impl<T> [T] {
11681168
///
11691169
/// # Panics
11701170
///
1171-
/// Panics if `chunk_size` is 0.
1171+
/// Panics if `chunk_size` is zero.
11721172
///
11731173
/// # Examples
11741174
///
@@ -1210,7 +1210,7 @@ impl<T> [T] {
12101210
///
12111211
/// # Panics
12121212
///
1213-
/// Panics if `chunk_size` is 0.
1213+
/// Panics if `chunk_size` is zero.
12141214
///
12151215
/// # Examples
12161216
///
@@ -1249,7 +1249,7 @@ impl<T> [T] {
12491249
///
12501250
/// # Panics
12511251
///
1252-
/// Panics if `chunk_size` is 0.
1252+
/// Panics if `chunk_size` is zero.
12531253
///
12541254
/// # Examples
12551255
///
@@ -1326,7 +1326,7 @@ impl<T> [T] {
13261326
///
13271327
/// # Panics
13281328
///
1329-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1329+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
13301330
/// error before this method gets stabilized.
13311331
///
13321332
/// # 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
@@ -1410,7 +1410,7 @@ impl<T> [T] {
14101410
///
14111411
/// # Panics
14121412
///
1413-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1413+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
14141414
/// error before this method gets stabilized.
14151415
///
14161416
/// # Examples
@@ -1486,7 +1486,7 @@ impl<T> [T] {
14861486
///
14871487
/// # Panics
14881488
///
1489-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1489+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
14901490
/// error before this method gets stabilized.
14911491
///
14921492
/// # Examples
@@ -1527,7 +1527,7 @@ impl<T> [T] {
15271527
///
15281528
/// # Panics
15291529
///
1530-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1530+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
15311531
/// error before this method gets stabilized.
15321532
///
15331533
/// # Examples
@@ -1571,7 +1571,7 @@ impl<T> [T] {
15711571
///
15721572
/// # Panics
15731573
///
1574-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1574+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
15751575
/// error before this method gets stabilized.
15761576
///
15771577
/// # Examples
@@ -1606,7 +1606,7 @@ impl<T> [T] {
16061606
///
16071607
/// # Panics
16081608
///
1609-
/// Panics if `N` is 0. This check will most probably get changed to a compile time
1609+
/// Panics if `N` is zero. This check will most probably get changed to a compile time
16101610
/// error before this method gets stabilized.
16111611
///
16121612
/// # Examples
@@ -1642,7 +1642,7 @@ impl<T> [T] {
16421642
///
16431643
/// # Panics
16441644
///
1645-
/// Panics if `chunk_size` is 0.
1645+
/// Panics if `chunk_size` is zero.
16461646
///
16471647
/// # Examples
16481648
///
@@ -1677,7 +1677,7 @@ impl<T> [T] {
16771677
///
16781678
/// # Panics
16791679
///
1680-
/// Panics if `chunk_size` is 0.
1680+
/// Panics if `chunk_size` is zero.
16811681
///
16821682
/// # Examples
16831683
///
@@ -1720,7 +1720,7 @@ impl<T> [T] {
17201720
///
17211721
/// # Panics
17221722
///
1723-
/// Panics if `chunk_size` is 0.
1723+
/// Panics if `chunk_size` is zero.
17241724
///
17251725
/// # Examples
17261726
///
@@ -1760,7 +1760,7 @@ impl<T> [T] {
17601760
///
17611761
/// # Panics
17621762
///
1763-
/// Panics if `chunk_size` is 0.
1763+
/// Panics if `chunk_size` is zero.
17641764
///
17651765
/// # Examples
17661766
///

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)