From 9b92c7deb93aedda14ca4401c5fc40a7cff596b0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 19 Dec 2019 11:52:51 -0800 Subject: [PATCH] cargo fmt --- rayon-core/src/job.rs | 4 ++-- rayon-core/src/join/mod.rs | 2 +- rayon-core/src/join/test.rs | 4 ++-- rayon-core/src/registry.rs | 12 +++++++----- rayon-core/src/scope/mod.rs | 2 +- rayon-core/src/scope/test.rs | 6 +++--- rayon-core/src/spawn/mod.rs | 2 +- rayon-core/src/test.rs | 4 ++-- rayon-core/src/thread_pool/mod.rs | 6 +++--- rayon-demo/src/main.rs | 4 ++-- src/iter/extend.rs | 7 +------ src/range.rs | 2 +- src/range_inclusive.rs | 2 +- 13 files changed, 27 insertions(+), 30 deletions(-) diff --git a/rayon-core/src/job.rs b/rayon-core/src/job.rs index c56a69254..27510cff2 100644 --- a/rayon-core/src/job.rs +++ b/rayon-core/src/job.rs @@ -1,9 +1,9 @@ -use crossbeam_queue::SegQueue; use crate::latch::Latch; +use crate::unwind; +use crossbeam_queue::SegQueue; use std::any::Any; use std::cell::UnsafeCell; use std::mem; -use crate::unwind; pub(super) enum JobResult { None, diff --git a/rayon-core/src/join/mod.rs b/rayon-core/src/join/mod.rs index c0aa06bff..295f97bc2 100644 --- a/rayon-core/src/join/mod.rs +++ b/rayon-core/src/join/mod.rs @@ -2,8 +2,8 @@ use crate::job::StackJob; use crate::latch::{LatchProbe, SpinLatch}; use crate::log::Event::*; use crate::registry::{self, WorkerThread}; -use std::any::Any; use crate::unwind; +use std::any::Any; use crate::FnContext; diff --git a/rayon-core/src/join/test.rs b/rayon-core/src/join/test.rs index 70afaffe2..7b5c7a2bb 100644 --- a/rayon-core/src/join/test.rs +++ b/rayon-core/src/join/test.rs @@ -1,11 +1,11 @@ //! Tests for the join code. use crate::join::*; +use crate::unwind; +use crate::ThreadPoolBuilder; use rand::distributions::Standard; use rand::{Rng, SeedableRng}; use rand_xorshift::XorShiftRng; -use crate::unwind; -use crate::ThreadPoolBuilder; fn quick_sort(v: &mut [T]) { if v.len() <= 1 { diff --git a/rayon-core/src/registry.rs b/rayon-core/src/registry.rs index ab6cbceee..20ec2549b 100644 --- a/rayon-core/src/registry.rs +++ b/rayon-core/src/registry.rs @@ -1,9 +1,14 @@ -use crossbeam_deque::{Steal, Stealer, Worker}; -use crossbeam_queue::SegQueue; use crate::job::{JobFifo, JobRef, StackJob}; use crate::latch::{CountLatch, Latch, LatchProbe, LockLatch, SpinLatch, TickleLatch}; use crate::log::Event::*; use crate::sleep::Sleep; +use crate::unwind; +use crate::util::leak; +use crate::{ + ErrorKind, ExitHandler, PanicHandler, StartHandler, ThreadPoolBuildError, ThreadPoolBuilder, +}; +use crossbeam_deque::{Steal, Stealer, Worker}; +use crossbeam_queue::SegQueue; use std::any::Any; use std::cell::Cell; use std::collections::hash_map::DefaultHasher; @@ -18,9 +23,6 @@ use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, Once}; use std::thread; use std::usize; -use crate::unwind; -use crate::util::leak; -use crate::{ErrorKind, ExitHandler, PanicHandler, StartHandler, ThreadPoolBuildError, ThreadPoolBuilder}; /// Thread builder used for customization via /// [`ThreadPoolBuilder::spawn_handler`](struct.ThreadPoolBuilder.html#method.spawn_handler). diff --git a/rayon-core/src/scope/mod.rs b/rayon-core/src/scope/mod.rs index 198c50617..bca4bd0a1 100644 --- a/rayon-core/src/scope/mod.rs +++ b/rayon-core/src/scope/mod.rs @@ -8,6 +8,7 @@ use crate::job::{HeapJob, JobFifo}; use crate::latch::{CountLatch, Latch}; use crate::log::Event::*; use crate::registry::{in_worker, Registry, WorkerThread}; +use crate::unwind; use std::any::Any; use std::fmt; use std::marker::PhantomData; @@ -15,7 +16,6 @@ use std::mem; use std::ptr; use std::sync::atomic::{AtomicPtr, Ordering}; use std::sync::Arc; -use crate::unwind; #[cfg(test)] mod test; diff --git a/rayon-core/src/scope/test.rs b/rayon-core/src/scope/test.rs index e3bd3e26f..3d855ecda 100644 --- a/rayon-core/src/scope/test.rs +++ b/rayon-core/src/scope/test.rs @@ -1,3 +1,6 @@ +use crate::unwind; +use crate::ThreadPoolBuilder; +use crate::{scope, scope_fifo, Scope}; use rand::{Rng, SeedableRng}; use rand_xorshift::XorShiftRng; use std::cmp; @@ -5,9 +8,6 @@ use std::iter::once; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Mutex; use std::vec; -use crate::unwind; -use crate::ThreadPoolBuilder; -use crate::{scope, scope_fifo, Scope}; #[test] fn scope_empty() { diff --git a/rayon-core/src/spawn/mod.rs b/rayon-core/src/spawn/mod.rs index 9dabb667a..ae418aad2 100644 --- a/rayon-core/src/spawn/mod.rs +++ b/rayon-core/src/spawn/mod.rs @@ -1,8 +1,8 @@ use crate::job::*; use crate::registry::Registry; +use crate::unwind; use std::mem; use std::sync::Arc; -use crate::unwind; /// Fires off a task into the Rayon threadpool in the "static" or /// "global" scope. Just like a standard thread, this task is not diff --git a/rayon-core/src/test.rs b/rayon-core/src/test.rs index b9fae03cd..015d3ec96 100644 --- a/rayon-core/src/test.rs +++ b/rayon-core/src/test.rs @@ -1,10 +1,10 @@ #![cfg(test)] -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::{Arc, Barrier}; #[allow(deprecated)] use crate::Configuration; use crate::{ThreadPoolBuildError, ThreadPoolBuilder}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{Arc, Barrier}; #[test] fn worker_thread_index() { diff --git a/rayon-core/src/thread_pool/mod.rs b/rayon-core/src/thread_pool/mod.rs index f701b92ed..065d236e0 100644 --- a/rayon-core/src/thread_pool/mod.rs +++ b/rayon-core/src/thread_pool/mod.rs @@ -6,14 +6,14 @@ use crate::join; use crate::registry::{Registry, ThreadSpawn, WorkerThread}; use crate::spawn; -use std::error::Error; -use std::fmt; -use std::sync::Arc; #[allow(deprecated)] use crate::Configuration; use crate::{scope, Scope}; use crate::{scope_fifo, ScopeFifo}; use crate::{ThreadPoolBuildError, ThreadPoolBuilder}; +use std::error::Error; +use std::fmt; +use std::sync::Arc; mod test; diff --git a/rayon-demo/src/main.rs b/rayon-demo/src/main.rs index c1be50236..f348a4812 100644 --- a/rayon-demo/src/main.rs +++ b/rayon-demo/src/main.rs @@ -42,10 +42,10 @@ extern crate serde_derive; // all extern crate glium; // nbody #[macro_use] extern crate lazy_static; // find -#[cfg(windows)] -extern crate winapi; // life #[cfg(test)] extern crate test; +#[cfg(windows)] +extern crate winapi; // life const USAGE: &str = " Usage: rayon-demo bench diff --git a/src/iter/extend.rs b/src/iter/extend.rs index 114375f72..b107c6b79 100644 --- a/src/iter/extend.rs +++ b/src/iter/extend.rs @@ -285,12 +285,7 @@ impl<'a> ParallelExtend<&'a char> for String { } fn string_reserve>(string: &mut String, list: &LinkedList>) { - let len = list - .iter() - .flatten() - .map(T::as_ref) - .map(str::len) - .sum(); + let len = list.iter().flatten().map(T::as_ref).map(str::len).sum(); string.reserve(len); } diff --git a/src/range.rs b/src/range.rs index 67b8e0b01..f3b0c5181 100644 --- a/src/range.rs +++ b/src/range.rs @@ -286,8 +286,8 @@ fn test_u128_opt_len() { #[test] #[cfg(target_pointer_width = "64")] fn test_usize_i64_overflow() { - use std::i64; use crate::ThreadPoolBuilder; + use std::i64; let iter = (-2..i64::MAX).into_par_iter(); assert_eq!(iter.opt_len(), Some(i64::MAX as usize + 2)); diff --git a/src/range_inclusive.rs b/src/range_inclusive.rs index 7b224f3a3..c1757701a 100644 --- a/src/range_inclusive.rs +++ b/src/range_inclusive.rs @@ -191,8 +191,8 @@ fn test_u128_opt_len() { #[test] #[cfg(target_pointer_width = "64")] fn test_usize_i64_overflow() { - use std::i64; use crate::ThreadPoolBuilder; + use std::i64; let iter = (-2..=i64::MAX).into_par_iter(); assert_eq!(iter.opt_len(), Some(i64::MAX as usize + 3));