Skip to content

Commit 9e77998

Browse files
Add "length" as doc alias to len methods
1 parent 6c523a7 commit 9e77998

File tree

13 files changed

+13
-0
lines changed

13 files changed

+13
-0
lines changed

library/alloc/src/collections/binary_heap.rs

+1
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,7 @@ impl<T> BinaryHeap<T> {
915915
///
916916
/// assert_eq!(heap.len(), 2);
917917
/// ```
918+
#[doc(alias = "length")]
918919
#[stable(feature = "rust1", since = "1.0.0")]
919920
pub fn len(&self) -> usize {
920921
self.data.len()

library/alloc/src/collections/btree/map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2132,6 +2132,7 @@ impl<K, V> BTreeMap<K, V> {
21322132
/// a.insert(1, "a");
21332133
/// assert_eq!(a.len(), 1);
21342134
/// ```
2135+
#[doc(alias = "length")]
21352136
#[stable(feature = "rust1", since = "1.0.0")]
21362137
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
21372138
pub const fn len(&self) -> usize {

library/alloc/src/collections/btree/set.rs

+1
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ impl<T> BTreeSet<T> {
975975
/// v.insert(1);
976976
/// assert_eq!(v.len(), 1);
977977
/// ```
978+
#[doc(alias = "length")]
978979
#[stable(feature = "rust1", since = "1.0.0")]
979980
#[rustc_const_unstable(feature = "const_btree_new", issue = "71835")]
980981
pub const fn len(&self) -> usize {

library/alloc/src/collections/linked_list.rs

+1
Original file line numberDiff line numberDiff line change
@@ -593,6 +593,7 @@ impl<T> LinkedList<T> {
593593
/// dl.push_back(3);
594594
/// assert_eq!(dl.len(), 3);
595595
/// ```
596+
#[doc(alias = "length")]
596597
#[inline]
597598
#[stable(feature = "rust1", since = "1.0.0")]
598599
pub fn len(&self) -> usize {

library/alloc/src/collections/vec_deque/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1038,6 +1038,7 @@ impl<T> VecDeque<T> {
10381038
/// v.push_back(1);
10391039
/// assert_eq!(v.len(), 1);
10401040
/// ```
1041+
#[doc(alias = "length")]
10411042
#[stable(feature = "rust1", since = "1.0.0")]
10421043
pub fn len(&self) -> usize {
10431044
count(self.tail, self.head, self.cap())

library/alloc/src/string.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1388,6 +1388,7 @@ impl String {
13881388
/// assert_eq!(fancy_f.len(), 4);
13891389
/// assert_eq!(fancy_f.chars().count(), 3);
13901390
/// ```
1391+
#[doc(alias = "length")]
13911392
#[inline]
13921393
#[stable(feature = "rust1", since = "1.0.0")]
13931394
pub fn len(&self) -> usize {

library/alloc/src/vec.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1559,6 +1559,7 @@ impl<T, A: Allocator> Vec<T, A> {
15591559
/// let a = vec![1, 2, 3];
15601560
/// assert_eq!(a.len(), 3);
15611561
/// ```
1562+
#[doc(alias = "length")]
15621563
#[inline]
15631564
#[stable(feature = "rust1", since = "1.0.0")]
15641565
pub fn len(&self) -> usize {

library/core/src/iter/traits/exact_size.rs

+1
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ pub trait ExactSizeIterator: Iterator {
9191
///
9292
/// assert_eq!(5, five.len());
9393
/// ```
94+
#[doc(alias = "length")]
9495
#[inline]
9596
#[stable(feature = "rust1", since = "1.0.0")]
9697
fn len(&self) -> usize {

library/core/src/slice/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ impl<T> [T] {
8484
/// let a = [1, 2, 3];
8585
/// assert_eq!(a.len(), 3);
8686
/// ```
87+
#[doc(alias = "length")]
8788
#[stable(feature = "rust1", since = "1.0.0")]
8889
#[rustc_const_stable(feature = "const_slice_len", since = "1.32.0")]
8990
#[inline]

library/core/src/str/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ impl str {
138138
/// assert_eq!("ƒoo".len(), 4); // fancy f!
139139
/// assert_eq!("ƒoo".chars().count(), 3);
140140
/// ```
141+
#[doc(alias = "length")]
141142
#[stable(feature = "rust1", since = "1.0.0")]
142143
#[rustc_const_stable(feature = "const_str_len", since = "1.32.0")]
143144
#[inline]

library/std/src/collections/hash/map.rs

+1
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,7 @@ impl<K, V, S> HashMap<K, V, S> {
448448
/// a.insert(1, "a");
449449
/// assert_eq!(a.len(), 1);
450450
/// ```
451+
#[doc(alias = "length")]
451452
#[stable(feature = "rust1", since = "1.0.0")]
452453
pub fn len(&self) -> usize {
453454
self.base.len()

library/std/src/collections/hash/set.rs

+1
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ impl<T, S> HashSet<T, S> {
199199
/// v.insert(1);
200200
/// assert_eq!(v.len(), 1);
201201
/// ```
202+
#[doc(alias = "length")]
202203
#[inline]
203204
#[stable(feature = "rust1", since = "1.0.0")]
204205
pub fn len(&self) -> usize {

library/std/src/ffi/os_str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,7 @@ impl OsStr {
653653
/// let os_str = OsStr::new("foo");
654654
/// assert_eq!(os_str.len(), 3);
655655
/// ```
656+
#[doc(alias = "length")]
656657
#[stable(feature = "osstring_simple_functions", since = "1.9.0")]
657658
pub fn len(&self) -> usize {
658659
self.inner.inner.len()

0 commit comments

Comments
 (0)