diff options
| author | David Tolnay <dtolnay@gmail.com> | 2019-11-24 01:43:32 -0800 |
|---|---|---|
| committer | David Tolnay <dtolnay@gmail.com> | 2019-11-26 23:02:11 -0800 |
| commit | 95e00bfed801e264e9c4ac817004153ca0f19eb6 (patch) | |
| tree | 79549f727c3fc8bb0b09779a7dc3f94df43654f2 /src/libcore/task | |
| parent | 809e180a76ce97340bf4354ff357bc59e3ca40b2 (diff) | |
| download | rust-95e00bfed801e264e9c4ac817004153ca0f19eb6.tar.gz rust-95e00bfed801e264e9c4ac817004153ca0f19eb6.zip | |
Format libcore with rustfmt
This commit applies rustfmt with default settings to files in
src/libcore *that are not involved in any currently open PR* to minimize
merge conflicts. The list of files involved in open PRs was determined
by querying GitHub's GraphQL API with this script:
https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8
With the list of files from the script in `outstanding_files`, the
relevant commands were:
$ find src/libcore -name '*.rs' | xargs rustfmt --edition=2018
$ rg libcore outstanding_files | xargs git checkout --
Repeating this process several months apart should get us coverage of
most of the rest of libcore.
Diffstat (limited to 'src/libcore/task')
| -rw-r--r-- | src/libcore/task/mod.rs | 2 | ||||
| -rw-r--r-- | src/libcore/task/poll.rs | 20 | ||||
| -rw-r--r-- | src/libcore/task/wake.rs | 25 |
3 files changed, 17 insertions, 30 deletions
diff --git a/src/libcore/task/mod.rs b/src/libcore/task/mod.rs index ef090928392..27760749c1d 100644 --- a/src/libcore/task/mod.rs +++ b/src/libcore/task/mod.rs @@ -8,4 +8,4 @@ pub use self::poll::Poll; mod wake; #[stable(feature = "futures_api", since = "1.36.0")] -pub use self::wake::{Context, Waker, RawWaker, RawWakerVTable}; +pub use self::wake::{Context, RawWaker, RawWakerVTable, Waker}; diff --git a/src/libcore/task/poll.rs b/src/libcore/task/poll.rs index fec17c4d1a4..d567ae54577 100644 --- a/src/libcore/task/poll.rs +++ b/src/libcore/task/poll.rs @@ -11,10 +11,7 @@ use crate::result::Result; pub enum Poll<T> { /// Represents that a value is immediately ready. #[stable(feature = "futures_api", since = "1.36.0")] - Ready( - #[stable(feature = "futures_api", since = "1.36.0")] - T - ), + Ready(#[stable(feature = "futures_api", since = "1.36.0")] T), /// Represents that a value is not ready yet. /// @@ -29,7 +26,8 @@ impl<T> Poll<T> { /// Changes the ready value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map<U, F>(self, f: F) -> Poll<U> - where F: FnOnce(T) -> U + where + F: FnOnce(T) -> U, { match self { Poll::Ready(t) => Poll::Ready(f(t)), @@ -59,7 +57,8 @@ impl<T, E> Poll<Result<T, E>> { /// Changes the success value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map_ok<U, F>(self, f: F) -> Poll<Result<U, E>> - where F: FnOnce(T) -> U + where + F: FnOnce(T) -> U, { match self { Poll::Ready(Ok(t)) => Poll::Ready(Ok(f(t))), @@ -71,7 +70,8 @@ impl<T, E> Poll<Result<T, E>> { /// Changes the error value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map_err<U, F>(self, f: F) -> Poll<Result<T, U>> - where F: FnOnce(E) -> U + where + F: FnOnce(E) -> U, { match self { Poll::Ready(Ok(t)) => Poll::Ready(Ok(t)), @@ -85,7 +85,8 @@ impl<T, E> Poll<Option<Result<T, E>>> { /// Changes the success value of this `Poll` with the closure provided. #[unstable(feature = "poll_map", issue = "63514")] pub fn map_ok<U, F>(self, f: F) -> Poll<Option<Result<U, E>>> - where F: FnOnce(T) -> U + where + F: FnOnce(T) -> U, { match self { Poll::Ready(Some(Ok(t))) => Poll::Ready(Some(Ok(f(t)))), @@ -98,7 +99,8 @@ impl<T, E> Poll<Option<Result<T, E>>> { /// Changes the error value of this `Poll` with the closure provided. #[unstable(feature = "poll_map", issue = "63514")] pub fn map_err<U, F>(self, f: F) -> Poll<Option<Result<T, U>>> - where F: FnOnce(E) -> U + where + F: FnOnce(E) -> U, { match self { Poll::Ready(Some(Ok(t))) => Poll::Ready(Some(Ok(t))), diff --git a/src/libcore/task/wake.rs b/src/libcore/task/wake.rs index 6f841bd2adf..0759ff93ea8 100644 --- a/src/libcore/task/wake.rs +++ b/src/libcore/task/wake.rs @@ -40,10 +40,7 @@ impl RawWaker { #[rustc_promotable] #[stable(feature = "futures_api", since = "1.36.0")] pub const fn new(data: *const (), vtable: &'static RawWakerVTable) -> RawWaker { - RawWaker { - data, - vtable, - } + RawWaker { data, vtable } } } @@ -160,12 +157,7 @@ impl RawWakerVTable { wake_by_ref: unsafe fn(*const ()), drop: unsafe fn(*const ()), ) -> Self { - Self { - clone, - wake, - wake_by_ref, - drop, - } + Self { clone, wake, wake_by_ref, drop } } } @@ -188,10 +180,7 @@ impl<'a> Context<'a> { #[stable(feature = "futures_api", since = "1.36.0")] #[inline] pub fn from_waker(waker: &'a Waker) -> Self { - Context { - waker, - _marker: PhantomData, - } + Context { waker, _marker: PhantomData } } /// Returns a reference to the `Waker` for the current task. @@ -205,9 +194,7 @@ impl<'a> Context<'a> { #[stable(feature = "futures_api", since = "1.36.0")] impl fmt::Debug for Context<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_struct("Context") - .field("waker", &self.waker) - .finish() + f.debug_struct("Context").field("waker", &self.waker).finish() } } @@ -291,9 +278,7 @@ impl Waker { #[inline] #[stable(feature = "futures_api", since = "1.36.0")] pub unsafe fn from_raw(waker: RawWaker) -> Waker { - Waker { - waker, - } + Waker { waker } } } |
