diff options
Diffstat (limited to 'src/libcore/ops/function.rs')
| -rw-r--r-- | src/libcore/ops/function.rs | 56 |
1 files changed, 35 insertions, 21 deletions
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<Args> : FnMut<Args> { +pub trait Fn<Args>: FnMut<Args> { /// 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<Args> : FnMut<Args> { #[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<Args> : FnOnce<Args> { +pub trait FnMut<Args>: FnOnce<Args> { /// 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<Args> : FnOnce<Args> { #[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<Args> { mod impls { #[stable(feature = "rust1", since = "1.0.0")] - impl<A,F:?Sized> Fn<A> for &F - where F : Fn<A> + impl<A, F: ?Sized> Fn<A> for &F + where + F: Fn<A>, { 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<A,F:?Sized> FnMut<A> for &F - where F : Fn<A> + impl<A, F: ?Sized> FnMut<A> for &F + where + F: Fn<A>, { 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<A,F:?Sized> FnOnce<A> for &F - where F : Fn<A> + impl<A, F: ?Sized> FnOnce<A> for &F + where + F: Fn<A>, { type Output = F::Output; @@ -254,8 +266,9 @@ mod impls { } #[stable(feature = "rust1", since = "1.0.0")] - impl<A,F:?Sized> FnMut<A> for &mut F - where F : FnMut<A> + impl<A, F: ?Sized> FnMut<A> for &mut F + where + F: FnMut<A>, { 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<A,F:?Sized> FnOnce<A> for &mut F - where F : FnMut<A> + impl<A, F: ?Sized> FnOnce<A> for &mut F + where + F: FnMut<A>, { type Output = F::Output; extern "rust-call" fn call_once(self, args: A) -> F::Output { |
