1
Fork 0

stabilize is_sorted

This commit is contained in:
Slanterns 2024-07-28 01:28:39 +08:00
parent 8fe0c753f2
commit ec0b354092
No known key found for this signature in database
GPG key ID: 1AA37EE7FAAE433A
18 changed files with 21 additions and 106 deletions

View file

@ -1984,14 +1984,18 @@ declare_lint! {
///
/// ```rust
/// trait MyIterator : Iterator {
/// // is_sorted is an unstable method that already exists on the Iterator trait
/// fn is_sorted(self) -> bool where Self: Sized {true}
/// // is_partitioned is an unstable method that already exists on the Iterator trait
/// fn is_partitioned<P>(self, predicate: P) -> bool
/// where
/// Self: Sized,
/// P: FnMut(Self::Item) -> bool,
/// {true}
/// }
///
/// impl<T: ?Sized> MyIterator for T where T: Iterator { }
///
/// let x = vec![1, 2, 3];
/// let _ = x.iter().is_sorted();
/// let _ = x.iter().is_partitioned(|_| true);
/// ```
///
/// {{produces}}
@ -2007,7 +2011,7 @@ declare_lint! {
/// is an early-warning to let you know that there may be a collision in
/// the future. This can be avoided by adding type annotations to
/// disambiguate which trait method you intend to call, such as
/// `MyIterator::is_sorted(my_iter)` or renaming or removing the method.
/// `MyIterator::is_partitioned(my_iter, my_predicate)` or renaming or removing the method.
///
/// [nightly channel]: https://doc.rust-lang.org/book/appendix-07-nightly-rust.html
/// [`feature` attribute]: https://doc.rust-lang.org/nightly/unstable-book/