From 4436c9d35498e7ae3da261f6141d6d73b915e1e8 Mon Sep 17 00:00:00 2001 From: David Tolnay Date: Wed, 27 Nov 2019 10:29:00 -0800 Subject: Format libstd with rustfmt This commit applies rustfmt with rust-lang/rust's default settings to files in src/libstd *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/libstd -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libstd outstanding_files | xargs git checkout -- Repeating this process several months apart should get us coverage of most of the rest of libstd. To confirm no funny business: $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference --- src/libstd/panic.rs | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) (limited to 'src/libstd/panic.rs') diff --git a/src/libstd/panic.rs b/src/libstd/panic.rs index cd024068d2d..ac8e0daf766 100644 --- a/src/libstd/panic.rs +++ b/src/libstd/panic.rs @@ -7,21 +7,21 @@ use crate::cell::UnsafeCell; use crate::collections; use crate::fmt; use crate::future::Future; -use crate::pin::Pin; use crate::ops::{Deref, DerefMut}; use crate::panicking; -use crate::ptr::{Unique, NonNull}; +use crate::pin::Pin; +use crate::ptr::{NonNull, Unique}; use crate::rc::Rc; -use crate::sync::{Arc, Mutex, RwLock}; use crate::sync::atomic; +use crate::sync::{Arc, Mutex, RwLock}; use crate::task::{Context, Poll}; use crate::thread::Result; #[stable(feature = "panic_hooks", since = "1.10.0")] -pub use crate::panicking::{take_hook, set_hook}; +pub use crate::panicking::{set_hook, take_hook}; #[stable(feature = "panic_hooks", since = "1.10.0")] -pub use core::panic::{PanicInfo, Location}; +pub use core::panic::{Location, PanicInfo}; /// A marker trait which represents "panic safe" types in Rust. /// @@ -103,8 +103,8 @@ pub use core::panic::{PanicInfo, Location}; /// [`AssertUnwindSafe`]: ./struct.AssertUnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] #[rustc_on_unimplemented( - message="the type `{Self}` may not be safely transferred across an unwind boundary", - label="`{Self}` may not be safely transferred across an unwind boundary", + message = "the type `{Self}` may not be safely transferred across an unwind boundary", + label = "`{Self}` may not be safely transferred across an unwind boundary" )] pub auto trait UnwindSafe {} @@ -121,10 +121,10 @@ pub auto trait UnwindSafe {} /// [`UnwindSafe`]: ./trait.UnwindSafe.html #[stable(feature = "catch_unwind", since = "1.9.0")] #[rustc_on_unimplemented( - message="the type `{Self}` may contain interior mutability and a reference may not be safely \ - transferrable across a catch_unwind boundary", - label="`{Self}` may contain interior mutability and a reference may not be safely \ - transferrable across a catch_unwind boundary", + message = "the type `{Self}` may contain interior mutability and a reference may not be safely \ + transferrable across a catch_unwind boundary", + label = "`{Self}` may contain interior mutability and a reference may not be safely \ + transferrable across a catch_unwind boundary" )] pub auto trait RefUnwindSafe {} @@ -187,10 +187,7 @@ pub auto trait RefUnwindSafe {} /// // ... /// ``` #[stable(feature = "catch_unwind", since = "1.9.0")] -pub struct AssertUnwindSafe( - #[stable(feature = "catch_unwind", since = "1.9.0")] - pub T -); +pub struct AssertUnwindSafe(#[stable(feature = "catch_unwind", since = "1.9.0")] pub T); // Implementations of the `UnwindSafe` trait: // @@ -290,7 +287,12 @@ impl RefUnwindSafe for atomic::AtomicPtr {} // https://github.com/rust-lang/rust/issues/62301 #[stable(feature = "hashbrown", since = "1.36.0")] impl UnwindSafe for collections::HashMap - where K: UnwindSafe, V: UnwindSafe, S: UnwindSafe {} +where + K: UnwindSafe, + V: UnwindSafe, + S: UnwindSafe, +{ +} #[stable(feature = "catch_unwind", since = "1.9.0")] impl Deref for AssertUnwindSafe { @@ -320,9 +322,7 @@ impl R> FnOnce<()> for AssertUnwindSafe { #[stable(feature = "std_debug", since = "1.16.0")] impl fmt::Debug for AssertUnwindSafe { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_tuple("AssertUnwindSafe") - .field(&self.0) - .finish() + f.debug_tuple("AssertUnwindSafe").field(&self.0).finish() } } @@ -391,9 +391,7 @@ impl Future for AssertUnwindSafe { /// ``` #[stable(feature = "catch_unwind", since = "1.9.0")] pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { - unsafe { - panicking::r#try(f) - } + unsafe { panicking::r#try(f) } } /// Triggers a panic without invoking the panic hook. -- cgit 1.4.1-3-g733a5