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/ops/function.rs | 56 ++++++++++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 21 deletions(-) (limited to 'src/libcore/ops/function.rs') diff --git a/src/libcore/ops/function.rs b/src/libcore/ops/function.rs index 35790324a2f..505a65cee3d 100644 --- a/src/libcore/ops/function.rs +++ b/src/libcore/ops/function.rs @@ -57,13 +57,16 @@ #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] #[rustc_on_unimplemented( - on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), - message="expected a `{Fn}<{Args}>` closure, found `{Self}`", - label="expected an `Fn<{Args}>` closure, found `{Self}`", + on( + Args = "()", + note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}" + ), + message = "expected a `{Fn}<{Args}>` closure, found `{Self}`", + label = "expected an `Fn<{Args}>` closure, found `{Self}`" )] #[fundamental] // so that regex can rely that `&str: !FnMut` #[must_use = "closures are lazy and do nothing unless called"] -pub trait Fn : FnMut { +pub trait Fn: FnMut { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] extern "rust-call" fn call(&self, args: Args) -> Self::Output; @@ -136,13 +139,16 @@ pub trait Fn : FnMut { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] #[rustc_on_unimplemented( - on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), - message="expected a `{FnMut}<{Args}>` closure, found `{Self}`", - label="expected an `FnMut<{Args}>` closure, found `{Self}`", + on( + Args = "()", + note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}" + ), + message = "expected a `{FnMut}<{Args}>` closure, found `{Self}`", + label = "expected an `FnMut<{Args}>` closure, found `{Self}`" )] #[fundamental] // so that regex can rely that `&str: !FnMut` #[must_use = "closures are lazy and do nothing unless called"] -pub trait FnMut : FnOnce { +pub trait FnMut: FnOnce { /// Performs the call operation. #[unstable(feature = "fn_traits", issue = "29625")] extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; @@ -207,9 +213,12 @@ pub trait FnMut : FnOnce { #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] #[rustc_on_unimplemented( - on(Args="()", note="wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}"), - message="expected a `{FnOnce}<{Args}>` closure, found `{Self}`", - label="expected an `FnOnce<{Args}>` closure, found `{Self}`", + on( + Args = "()", + note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}" + ), + message = "expected a `{FnOnce}<{Args}>` closure, found `{Self}`", + label = "expected an `FnOnce<{Args}>` closure, found `{Self}`" )] #[fundamental] // so that regex can rely that `&str: !FnMut` #[must_use = "closures are lazy and do nothing unless called"] @@ -225,8 +234,9 @@ pub trait FnOnce { mod impls { #[stable(feature = "rust1", since = "1.0.0")] - impl Fn for &F - where F : Fn + impl Fn for &F + where + F: Fn, { extern "rust-call" fn call(&self, args: A) -> F::Output { (**self).call(args) @@ -234,8 +244,9 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl FnMut for &F - where F : Fn + impl FnMut for &F + where + F: Fn, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (**self).call(args) @@ -243,8 +254,9 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl FnOnce for &F - where F : Fn + impl FnOnce for &F + where + F: Fn, { type Output = F::Output; @@ -254,8 +266,9 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl FnMut for &mut F - where F : FnMut + impl FnMut for &mut F + where + F: FnMut, { extern "rust-call" fn call_mut(&mut self, args: A) -> F::Output { (*self).call_mut(args) @@ -263,8 +276,9 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl FnOnce for &mut F - where F : FnMut + impl FnOnce for &mut F + where + F: FnMut, { type Output = F::Output; extern "rust-call" fn call_once(self, args: A) -> F::Output { -- cgit 1.4.1-3-g733a5