Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
cuviper committed Dec 19, 2019
1 parent e02f439 commit 9b92c7d
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 30 deletions.
4 changes: 2 additions & 2 deletions rayon-core/src/job.rs
Original file line number Diff line number Diff line change
@@ -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<T> {
None,
Expand Down
2 changes: 1 addition & 1 deletion rayon-core/src/join/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions rayon-core/src/join/test.rs
Original file line number Diff line number Diff line change
@@ -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<T: PartialOrd + Send>(v: &mut [T]) {
if v.len() <= 1 {
Expand Down
12 changes: 7 additions & 5 deletions rayon-core/src/registry.rs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion rayon-core/src/scope/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ 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;
use std::mem;
use std::ptr;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::sync::Arc;
use crate::unwind;

#[cfg(test)]
mod test;
Expand Down
6 changes: 3 additions & 3 deletions rayon-core/src/scope/test.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::unwind;
use crate::ThreadPoolBuilder;
use crate::{scope, scope_fifo, Scope};
use rand::{Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use std::cmp;
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() {
Expand Down
2 changes: 1 addition & 1 deletion rayon-core/src/spawn/mod.rs
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions rayon-core/src/test.rs
Original file line number Diff line number Diff line change
@@ -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() {
Expand Down
6 changes: 3 additions & 3 deletions rayon-core/src/thread_pool/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions rayon-demo/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions src/iter/extend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,12 +285,7 @@ impl<'a> ParallelExtend<&'a char> for String {
}

fn string_reserve<T: AsRef<str>>(string: &mut String, list: &LinkedList<Vec<T>>) {
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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion src/range_inclusive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 9b92c7d

Please sign in to comment.