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.
This commit is contained in:
David Tolnay 2019-11-24 01:43:32 -08:00
parent 809e180a76
commit 95e00bfed8
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
52 changed files with 1801 additions and 1295 deletions

View file

@ -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 {