From 95e00bfed801e264e9c4ac817004153ca0f19eb6 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Sun, 24 Nov 2019 01:43:32 -0800 Subject: 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. --- src/libcore/task/mod.rs | 2 +- src/libcore/task/poll.rs | 20 +++++++++++--------- src/libcore/task/wake.rs | 25 +++++-------------------- 3 files changed, 17 insertions(+), 30 deletions(-) (limited to 'src/libcore/task') 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 { /// 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 Poll { /// Changes the ready value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map(self, f: F) -> Poll - where F: FnOnce(T) -> U + where + F: FnOnce(T) -> U, { match self { Poll::Ready(t) => Poll::Ready(f(t)), @@ -59,7 +57,8 @@ impl Poll> { /// Changes the success value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map_ok(self, f: F) -> Poll> - 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 Poll> { /// Changes the error value of this `Poll` with the closure provided. #[stable(feature = "futures_api", since = "1.36.0")] pub fn map_err(self, f: F) -> Poll> - 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 Poll>> { /// Changes the success value of this `Poll` with the closure provided. #[unstable(feature = "poll_map", issue = "63514")] pub fn map_ok(self, f: F) -> Poll>> - 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 Poll>> { /// Changes the error value of this `Poll` with the closure provided. #[unstable(feature = "poll_map", issue = "63514")] pub fn map_err(self, f: F) -> Poll>> - 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 } } } -- cgit 1.4.1-3-g733a5