File tree Expand file tree Collapse file tree 13 files changed +33
-43
lines changed Expand file tree Collapse file tree 13 files changed +33
-43
lines changed Original file line number Diff line number Diff line change @@ -28,15 +28,15 @@ pub trait AsyncIterator {
28
28
/// async iterator state:
29
29
///
30
30
/// - `Poll::Pending` means that this async iterator's next value is not ready
31
- /// yet. Implementations will ensure that the current task will be notified
32
- /// when the next value may be ready.
31
+ /// yet. Implementations will ensure that the current task will be notified
32
+ /// when the next value may be ready.
33
33
///
34
34
/// - `Poll::Ready(Some(val))` means that the async iterator has successfully
35
- /// produced a value, `val`, and may produce further values on subsequent
36
- /// `poll_next` calls.
35
+ /// produced a value, `val`, and may produce further values on subsequent
36
+ /// `poll_next` calls.
37
37
///
38
38
/// - `Poll::Ready(None)` means that the async iterator has terminated, and
39
- /// `poll_next` should not be invoked again.
39
+ /// `poll_next` should not be invoked again.
40
40
///
41
41
/// # Panics
42
42
///
Original file line number Diff line number Diff line change @@ -1482,13 +1482,14 @@ pub trait PartialOrd<Rhs: PointeeSized = Self>: PartialEq<Rhs> + PointeeSized {
1482
1482
}
1483
1483
}
1484
1484
1485
- fn default_chaining_impl < T : PointeeSized , U : PointeeSized > (
1485
+ fn default_chaining_impl < T , U > (
1486
1486
lhs : & T ,
1487
1487
rhs : & U ,
1488
1488
p : impl FnOnce ( Ordering ) -> bool ,
1489
1489
) -> ControlFlow < bool >
1490
1490
where
1491
- T : PartialOrd < U > ,
1491
+ T : PartialOrd < U > + PointeeSized ,
1492
+ U : PointeeSized ,
1492
1493
{
1493
1494
// It's important that this only call `partial_cmp` once, not call `eq` then
1494
1495
// one of the relational operators. We don't want to `bcmp`-then-`memcp` a
Original file line number Diff line number Diff line change @@ -854,7 +854,6 @@ impl Display for Arguments<'_> {
854
854
/// }";
855
855
/// assert_eq!(format!("The origin is: {origin:#?}"), expected);
856
856
/// ```
857
-
858
857
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
859
858
#[ rustc_on_unimplemented(
860
859
on(
Original file line number Diff line number Diff line change @@ -436,7 +436,6 @@ pub trait Extend<A> {
436
436
/// **For implementors:** For a collection to unsafely rely on this method's safety precondition (that is,
437
437
/// invoke UB if they are violated), it must implement `extend_reserve` correctly. In other words,
438
438
/// callers may assume that if they `extend_reserve`ed enough space they can call this method.
439
-
440
439
// This method is for internal usage only. It is only on the trait because of specialization's limitations.
441
440
#[ unstable( feature = "extend_one_unchecked" , issue = "none" ) ]
442
441
#[ doc( hidden) ]
Original file line number Diff line number Diff line change @@ -3414,10 +3414,9 @@ pub trait Iterator {
3414
3414
/// ```
3415
3415
#[ stable( feature = "iter_copied" , since = "1.36.0" ) ]
3416
3416
#[ rustc_diagnostic_item = "iter_copied" ]
3417
- fn copied < ' a , T : ' a > ( self ) -> Copied < Self >
3417
+ fn copied < ' a , T : Copy + ' a > ( self ) -> Copied < Self >
3418
3418
where
3419
3419
Self : Sized + Iterator < Item = & ' a T > ,
3420
- T : Copy ,
3421
3420
{
3422
3421
Copied :: new ( self )
3423
3422
}
@@ -3462,10 +3461,9 @@ pub trait Iterator {
3462
3461
/// ```
3463
3462
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
3464
3463
#[ rustc_diagnostic_item = "iter_cloned" ]
3465
- fn cloned < ' a , T : ' a > ( self ) -> Cloned < Self >
3464
+ fn cloned < ' a , T : Clone + ' a > ( self ) -> Cloned < Self >
3466
3465
where
3467
3466
Self : Sized + Iterator < Item = & ' a T > ,
3468
- T : Clone ,
3469
3467
{
3470
3468
Cloned :: new ( self )
3471
3469
}
Original file line number Diff line number Diff line change 39
39
//! return. You should mark your implementation using `#[panic_handler]`.
40
40
//!
41
41
//! * `rust_eh_personality` - is used by the failure mechanisms of the
42
- //! compiler. This is often mapped to GCC's personality function, but crates
43
- //! which do not trigger a panic can be assured that this function is never
44
- //! called. The `lang` attribute is called `eh_personality`.
42
+ //! compiler. This is often mapped to GCC's personality function, but crates
43
+ //! which do not trigger a panic can be assured that this function is never
44
+ //! called. The `lang` attribute is called `eh_personality`.
45
45
46
46
#![ stable( feature = "core" , since = "1.6.0" ) ]
47
47
#![ doc(
Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ pub use crate::intrinsics::transmute;
36
36
/// * If you want to leak memory, see [`Box::leak`].
37
37
/// * If you want to obtain a raw pointer to the memory, see [`Box::into_raw`].
38
38
/// * If you want to dispose of a value properly, running its destructor, see
39
- /// [`mem::drop`].
39
+ /// [`mem::drop`].
40
40
///
41
41
/// # Safety
42
42
///
Original file line number Diff line number Diff line change @@ -787,7 +787,6 @@ impl Ipv4Addr {
787
787
/// [IANA IPv4 Special-Purpose Address Registry]: https://www.iana.org/assignments/iana-ipv4-special-registry/iana-ipv4-special-registry.xhtml
788
788
/// [unspecified address]: Ipv4Addr::UNSPECIFIED
789
789
/// [broadcast address]: Ipv4Addr::BROADCAST
790
-
791
790
///
792
791
/// # Examples
793
792
///
Original file line number Diff line number Diff line change @@ -150,23 +150,19 @@ pub fn round_up(d: &mut [u8]) -> Option<u8> {
150
150
Some ( i) => {
151
151
// d[i+1..n] is all nines
152
152
d[ i] += 1 ;
153
- for j in i + 1 ..d. len ( ) {
154
- d[ j] = b'0' ;
155
- }
153
+ d. iter_mut ( ) . skip ( i + 1 ) . for_each ( |c| * c = b'0' ) ;
156
154
None
157
155
}
158
- None if d. len ( ) > 0 => {
156
+ None if d. is_empty ( ) => {
157
+ // an empty buffer rounds up (a bit strange but reasonable)
158
+ Some ( b'1' )
159
+ }
160
+ None => {
159
161
// 999..999 rounds to 1000..000 with an increased exponent
160
162
d[ 0 ] = b'1' ;
161
- for j in 1 ..d. len ( ) {
162
- d[ j] = b'0' ;
163
- }
163
+ d. iter_mut ( ) . skip ( 1 ) . for_each ( |c| * c = b'0' ) ;
164
164
Some ( b'0' )
165
165
}
166
- None => {
167
- // an empty buffer rounds up (a bit strange but reasonable)
168
- Some ( b'1' )
169
- }
170
166
}
171
167
}
172
168
Original file line number Diff line number Diff line change 1
- /// These functions compute the integer logarithm of their type, assuming
2
- /// that someone has already checked that the value is strictly positive.
1
+ //! These functions compute the integer logarithm of their type, assuming
2
+ //! that someone has already checked that the value is strictly positive.
3
3
4
4
// 0 < val <= u8::MAX
5
5
#[ inline]
You can’t perform that action at this time.
0 commit comments