Skip to content

Commit

Permalink
Also use zero when referencing to capacity or length
Browse files Browse the repository at this point in the history
  • Loading branch information
timvisee authored and gitbot committed Mar 4, 2025
1 parent dede273 commit b3b1d69
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions alloc/src/collections/binary_heap/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ impl<T: Ord> BinaryHeap<T> {
///
/// The binary heap will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the binary heap will not allocate.
/// `capacity`. If `capacity` is zero, the binary heap will not allocate.
///
/// # Examples
///
Expand Down Expand Up @@ -496,7 +496,7 @@ impl<T: Ord, A: Allocator> BinaryHeap<T, A> {
///
/// The binary heap will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the binary heap will not allocate.
/// `capacity`. If `capacity` is zero, the binary heap will not allocate.
///
/// # Examples
///
Expand Down
8 changes: 4 additions & 4 deletions alloc/src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ impl<T> Vec<T> {
///
/// The vector will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the vector will not allocate.
/// `capacity`. If `capacity` is zero, the vector will not allocate.
///
/// It is important to note that although the returned vector has the
/// minimum *capacity* specified, the vector will have a zero *length*. For
Expand Down Expand Up @@ -487,7 +487,7 @@ impl<T> Vec<T> {
///
/// The vector will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the vector will not allocate.
/// `capacity`. If `capacity` is zero, the vector will not allocate.
///
/// # Errors
///
Expand Down Expand Up @@ -745,7 +745,7 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// The vector will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the vector will not allocate.
/// `capacity`. If `capacity` is zero, the vector will not allocate.
///
/// It is important to note that although the returned vector has the
/// minimum *capacity* specified, the vector will have a zero *length*. For
Expand Down Expand Up @@ -808,7 +808,7 @@ impl<T, A: Allocator> Vec<T, A> {
///
/// The vector will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the vector will not allocate.
/// `capacity`. If `capacity` is zero, the vector will not allocate.
///
/// # Errors
///
Expand Down
4 changes: 2 additions & 2 deletions core/src/iter/traits/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ pub trait Iterator {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a
/// Panics if `N` is zero. This check will most probably get changed to a
/// compile time error before this method gets stabilized.
///
/// ```should_panic
Expand Down Expand Up @@ -3454,7 +3454,7 @@ pub trait Iterator {
///
/// # Panics
///
/// Panics if `N` is 0.
/// Panics if `N` is zero.
///
/// # Examples
///
Expand Down
32 changes: 16 additions & 16 deletions core/src/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1077,7 +1077,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `size` is 0.
/// Panics if `size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1133,7 +1133,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1168,7 +1168,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1210,7 +1210,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1249,7 +1249,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1326,7 +1326,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1372,7 +1372,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1410,7 +1410,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1486,7 +1486,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1527,7 +1527,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1571,7 +1571,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1606,7 +1606,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `N` is 0. This check will most probably get changed to a compile time
/// Panics if `N` is zero. This check will most probably get changed to a compile time
/// error before this method gets stabilized.
///
/// # Examples
Expand Down Expand Up @@ -1642,7 +1642,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1677,7 +1677,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1720,7 +1720,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down Expand Up @@ -1760,7 +1760,7 @@ impl<T> [T] {
///
/// # Panics
///
/// Panics if `chunk_size` is 0.
/// Panics if `chunk_size` is zero.
///
/// # Examples
///
Expand Down
4 changes: 2 additions & 2 deletions std/src/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ impl<K, V> HashMap<K, V, RandomState> {
///
/// The hash map will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the hash map will not allocate.
/// `capacity`. If `capacity` is zero, the hash map will not allocate.
///
/// # Examples
///
Expand Down Expand Up @@ -287,7 +287,7 @@ impl<K, V, S> HashMap<K, V, S> {
///
/// The hash map will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the hash map will not allocate.
/// `capacity`. If `capacity` is zero, the hash map will not allocate.
///
/// Warning: `hasher` is normally randomly generated, and
/// is designed to allow HashMaps to be resistant to attacks that
Expand Down
4 changes: 2 additions & 2 deletions std/src/collections/hash/set.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ impl<T> HashSet<T, RandomState> {
///
/// The hash set will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the hash set will not allocate.
/// `capacity`. If `capacity` is zero, the hash set will not allocate.
///
/// # Examples
///
Expand Down Expand Up @@ -379,7 +379,7 @@ impl<T, S> HashSet<T, S> {
///
/// The hash set will be able to hold at least `capacity` elements without
/// reallocating. This method is allowed to allocate for more elements than
/// `capacity`. If `capacity` is 0, the hash set will not allocate.
/// `capacity`. If `capacity` is zero, the hash set will not allocate.
///
/// Warning: `hasher` is normally randomly generated, and
/// is designed to allow `HashSet`s to be resistant to attacks that
Expand Down

0 comments on commit b3b1d69

Please sign in to comment.