Skip to content

Commit 96eb5e1

Browse files
committed
Format ControlFlow changes with rustfmt
1 parent d0af125 commit 96eb5e1

File tree

6 files changed

+18
-13
lines changed

6 files changed

+18
-13
lines changed

library/core/src/iter/adapters/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::cmp;
22
use crate::fmt;
33
use crate::intrinsics;
4-
use crate::ops::{Add, AddAssign, Try, ControlFlow};
4+
use crate::ops::{Add, AddAssign, ControlFlow, Try};
55

66
use super::from_fn;
77
use super::{DoubleEndedIterator, ExactSizeIterator, FusedIterator, Iterator, TrustedLen};

library/core/src/iter/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -365,4 +365,3 @@ mod adapters;
365365
mod range;
366366
mod sources;
367367
mod traits;
368-

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::ops::{Try, ControlFlow};
1+
use crate::ops::{ControlFlow, Try};
22

33
/// An iterator able to yield elements from both ends.
44
///

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

+9-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// can't split that into multiple files.
44

55
use crate::cmp::{self, Ordering};
6-
use crate::ops::{Add, Try, ControlFlow};
6+
use crate::ops::{Add, ControlFlow, Try};
77

88
use super::super::TrustedRandomAccess;
99
use super::super::{Chain, Cloned, Copied, Cycle, Enumerate, Filter, FilterMap, Fuse};
@@ -2234,7 +2234,9 @@ pub trait Iterator {
22342234
F: FnMut(Self::Item) -> Option<B>,
22352235
{
22362236
#[inline]
2237-
fn check<T, B>(mut f: impl FnMut(T) -> Option<B>) -> impl FnMut((), T) -> ControlFlow<(), B> {
2237+
fn check<T, B>(
2238+
mut f: impl FnMut(T) -> Option<B>,
2239+
) -> impl FnMut((), T) -> ControlFlow<(), B> {
22382240
move |(), x| match f(x) {
22392241
Some(x) => ControlFlow::Break(x),
22402242
None => ControlFlow::Continue(()),
@@ -2354,7 +2356,11 @@ pub trait Iterator {
23542356
) -> impl FnMut(usize, T) -> ControlFlow<usize, usize> {
23552357
// The addition might panic on overflow
23562358
move |i, x| {
2357-
if predicate(x) { ControlFlow::Break(i) } else { ControlFlow::Continue(Add::add(i, 1)) }
2359+
if predicate(x) {
2360+
ControlFlow::Break(i)
2361+
} else {
2362+
ControlFlow::Continue(Add::add(i, 1))
2363+
}
23582364
}
23592365
}
23602366

library/core/src/ops/control_flow.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::ops::Try;
22

33
/// Used to make try_fold closures more like normal loops
4-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
4+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
55
#[derive(Debug, Clone, Copy, PartialEq)]
66
pub enum ControlFlow<C, B> {
77
/// Continue in the loop, using the given value for the next iteration
@@ -10,7 +10,7 @@ pub enum ControlFlow<C, B> {
1010
Break(B),
1111
}
1212

13-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
13+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
1414
impl<C, B> Try for ControlFlow<C, B> {
1515
type Ok = C;
1616
type Error = B;
@@ -35,7 +35,7 @@ impl<C, B> ControlFlow<C, B> {
3535
/// Converts the `ControlFlow` into an `Option` which is `Some` if the
3636
/// `ControlFlow` was `Break` and `None` otherwise.
3737
#[inline]
38-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
38+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
3939
pub fn break_value(self) -> Option<B> {
4040
match self {
4141
ControlFlow::Continue(..) => None,
@@ -46,7 +46,7 @@ impl<C, B> ControlFlow<C, B> {
4646

4747
impl<R: Try> ControlFlow<R::Ok, R> {
4848
/// Create a `ControlFlow` from any type implementing `Try`.
49-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
49+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
5050
#[inline]
5151
pub fn from_try(r: R) -> Self {
5252
match Try::into_result(r) {
@@ -56,7 +56,7 @@ impl<R: Try> ControlFlow<R::Ok, R> {
5656
}
5757

5858
/// Convert a `ControlFlow` into any type implementing `Try`;
59-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
59+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
6060
#[inline]
6161
pub fn into_try(self) -> R {
6262
match self {

library/core/src/ops/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140

141141
mod arith;
142142
mod bit;
143+
mod control_flow;
143144
mod deref;
144145
mod drop;
145146
mod function;
@@ -148,7 +149,6 @@ mod index;
148149
mod range;
149150
mod r#try;
150151
mod unsize;
151-
mod control_flow;
152152

153153
#[stable(feature = "rust1", since = "1.0.0")]
154154
pub use self::arith::{Add, Div, Mul, Neg, Rem, Sub};
@@ -193,5 +193,5 @@ pub use self::unsize::CoerceUnsized;
193193
#[unstable(feature = "dispatch_from_dyn", issue = "none")]
194194
pub use self::unsize::DispatchFromDyn;
195195

196-
#[unstable(feature="control_flow_enum", reason="new API", issue="75744")]
196+
#[unstable(feature = "control_flow_enum", reason = "new API", issue = "75744")]
197197
pub use self::control_flow::ControlFlow;

0 commit comments

Comments
 (0)