Skip to content

Commit 1d78a61

Browse files
committed
Auto merge of #33948 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 10 pull requests - Successful merges: #33793, #33893, #33902, #33912, #33913, #33914, #33917, #33931, #33937, #33938 - Failed merges:
2 parents 8f3e8c7 + 1aaa7b2 commit 1d78a61

File tree

31 files changed

+804
-504
lines changed

31 files changed

+804
-504
lines changed

src/liballoc/arc.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
use boxed::Box;
7373

7474
use core::sync::atomic;
75-
use core::sync::atomic::Ordering::{Relaxed, Release, Acquire, SeqCst};
75+
use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
7676
use core::borrow;
7777
use core::fmt;
7878
use core::cmp::Ordering;
@@ -85,7 +85,7 @@ use core::ops::CoerceUnsized;
8585
use core::ptr::{self, Shared};
8686
use core::marker::Unsize;
8787
use core::hash::{Hash, Hasher};
88-
use core::{usize, isize};
88+
use core::{isize, usize};
8989
use core::convert::From;
9090
use heap::deallocate;
9191

@@ -608,11 +608,13 @@ impl<T> Weak<T> {
608608
#[stable(feature = "downgraded_weak", since = "1.10.0")]
609609
pub fn new() -> Weak<T> {
610610
unsafe {
611-
Weak { ptr: Shared::new(Box::into_raw(box ArcInner {
612-
strong: atomic::AtomicUsize::new(0),
613-
weak: atomic::AtomicUsize::new(1),
614-
data: uninitialized(),
615-
}))}
611+
Weak {
612+
ptr: Shared::new(Box::into_raw(box ArcInner {
613+
strong: atomic::AtomicUsize::new(0),
614+
weak: atomic::AtomicUsize::new(1),
615+
data: uninitialized(),
616+
})),
617+
}
616618
}
617619
}
618620
}
@@ -655,7 +657,9 @@ impl<T: ?Sized> Weak<T> {
655657

656658
// See comments in `Arc::clone` for why we do this (for `mem::forget`).
657659
if n > MAX_REFCOUNT {
658-
unsafe { abort(); }
660+
unsafe {
661+
abort();
662+
}
659663
}
660664

661665
// Relaxed is valid for the same reason it is on Arc's Clone impl
@@ -946,7 +950,7 @@ mod tests {
946950
use std::mem::drop;
947951
use std::ops::Drop;
948952
use std::option::Option;
949-
use std::option::Option::{Some, None};
953+
use std::option::Option::{None, Some};
950954
use std::sync::atomic;
951955
use std::sync::atomic::Ordering::{Acquire, SeqCst};
952956
use std::thread;

src/liballoc/boxed.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ use core::hash::{self, Hash};
6464
use core::marker::{self, Unsize};
6565
use core::mem;
6666
use core::ops::{CoerceUnsized, Deref, DerefMut};
67-
use core::ops::{Placer, Boxed, Place, InPlace, BoxPlace};
67+
use core::ops::{BoxPlace, Boxed, InPlace, Place, Placer};
6868
use core::ptr::{self, Unique};
6969
use core::raw::TraitObject;
7070
use core::convert::From;
@@ -535,7 +535,8 @@ pub trait FnBox<A> {
535535

536536
#[unstable(feature = "fnbox",
537537
reason = "will be deprecated if and when Box<FnOnce> becomes usable", issue = "28796")]
538-
impl<A, F> FnBox<A> for F where F: FnOnce<A>
538+
impl<A, F> FnBox<A> for F
539+
where F: FnOnce<A>
539540
{
540541
type Output = F::Output;
541542

src/liballoc/boxed_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
1313
use core::any::Any;
1414
use core::ops::Deref;
15-
use core::result::Result::{Ok, Err};
15+
use core::result::Result::{Err, Ok};
1616
use core::clone::Clone;
1717

1818
use std::boxed::Box;

src/liballoc/heap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
use core::{isize, usize};
1919
#[cfg(not(test))]
20-
use core::intrinsics::{size_of, min_align_of};
20+
use core::intrinsics::{min_align_of, size_of};
2121

2222
#[allow(improper_ctypes)]
2323
extern "C" {

src/liballoc/rc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,11 @@ use core::borrow;
159159
use core::cell::Cell;
160160
use core::cmp::Ordering;
161161
use core::fmt;
162-
use core::hash::{Hasher, Hash};
163-
use core::intrinsics::{assume, abort};
162+
use core::hash::{Hash, Hasher};
163+
use core::intrinsics::{abort, assume};
164164
use core::marker;
165165
use core::marker::Unsize;
166-
use core::mem::{self, align_of_val, size_of_val, forget, uninitialized};
166+
use core::mem::{self, align_of_val, forget, size_of_val, uninitialized};
167167
use core::ops::Deref;
168168
use core::ops::CoerceUnsized;
169169
use core::ptr::{self, Shared};
@@ -935,7 +935,7 @@ mod tests {
935935
use std::boxed::Box;
936936
use std::cell::RefCell;
937937
use std::option::Option;
938-
use std::option::Option::{Some, None};
938+
use std::option::Option::{None, Some};
939939
use std::result::Result::{Err, Ok};
940940
use std::mem::drop;
941941
use std::clone::Clone;

src/libcollections/str.rs

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,34 @@ impl str {
10971097
/// assert_eq!(d, &["", "", "", "", "a", "", "b", "c"]);
10981098
/// ```
10991099
///
1100-
/// This can lead to possibly surprising behavior when whitespace is used
1101-
/// as the separator. This code is correct:
1100+
/// Contiguous separators are separated by the empty string.
1101+
///
1102+
/// ```
1103+
/// let x = "(///)".to_string();
1104+
/// let d: Vec<_> = x.split('/').collect();;
1105+
///
1106+
/// assert_eq!(d, &["(", "", "", ")"]);
1107+
/// ```
1108+
///
1109+
/// Separators at the start or end of a string are neighbored
1110+
/// by empty strings.
1111+
///
1112+
/// ```
1113+
/// let d: Vec<_> = "010".split("0").collect();
1114+
/// assert_eq!(d, &["", "1", ""]);
1115+
/// ```
1116+
///
1117+
/// When the empty string is used as a separator, it separates
1118+
/// every character in the string, along with the beginning
1119+
/// and end of the string.
1120+
///
1121+
/// ```
1122+
/// let f: Vec<_> = "rust".split("").collect();
1123+
/// assert_eq!(f, &["", "r", "u", "s", "t", ""]);
1124+
/// ```
1125+
///
1126+
/// Contiguous separators can lead to possibly surprising behavior
1127+
/// when whitespace is used as the separator. This code is correct:
11021128
///
11031129
/// ```
11041130
/// let x = " a b c".to_string();

src/librand/chacha.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
//! The ChaCha random number generator.
1212
13-
use {Rng, SeedableRng, Rand};
13+
use {Rand, Rng, SeedableRng};
1414

1515
const KEY_WORDS: usize = 8; // 8 words for the 256-bit key
1616
const STATE_WORDS: usize = 16;
@@ -216,7 +216,8 @@ mod tests {
216216
let s = ::test::rng().gen_iter::<u32>().take(8).collect::<Vec<u32>>();
217217
let mut ra: ChaChaRng = SeedableRng::from_seed(&*s);
218218
let mut rb: ChaChaRng = SeedableRng::from_seed(&*s);
219-
assert!(ra.gen_ascii_chars().take(100)
219+
assert!(ra.gen_ascii_chars()
220+
.take(100)
220221
.eq(rb.gen_ascii_chars().take(100)));
221222
}
222223

@@ -225,7 +226,8 @@ mod tests {
225226
let seed: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
226227
let mut ra: ChaChaRng = SeedableRng::from_seed(seed);
227228
let mut rb: ChaChaRng = SeedableRng::from_seed(seed);
228-
assert!(ra.gen_ascii_chars().take(100)
229+
assert!(ra.gen_ascii_chars()
230+
.take(100)
229231
.eq(rb.gen_ascii_chars().take(100)));
230232
}
231233

src/librand/distributions/exponential.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
#[cfg(not(test))] // only necessary for no_std
1414
use FloatMath;
1515

16-
use {Rng, Rand};
17-
use distributions::{ziggurat, ziggurat_tables, Sample, IndependentSample};
16+
use {Rand, Rng};
17+
use distributions::{IndependentSample, Sample, ziggurat, ziggurat_tables};
1818

1919
/// A wrapper around an `f64` to generate Exp(1) random numbers.
2020
///
@@ -88,7 +88,7 @@ impl IndependentSample<f64> for Exp {
8888

8989
#[cfg(test)]
9090
mod tests {
91-
use distributions::{Sample, IndependentSample};
91+
use distributions::{IndependentSample, Sample};
9292
use super::Exp;
9393

9494
#[test]

src/librand/distributions/gamma.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ use self::ChiSquaredRepr::*;
1616
#[cfg(not(test))] // only necessary for no_std
1717
use FloatMath;
1818

19-
use {Rng, Open01};
19+
use {Open01, Rng};
2020
use super::normal::StandardNormal;
21-
use super::{IndependentSample, Sample, Exp};
21+
use super::{Exp, IndependentSample, Sample};
2222

2323
/// The Gamma distribution `Gamma(shape, scale)` distribution.
2424
///
@@ -291,8 +291,8 @@ impl IndependentSample<f64> for StudentT {
291291

292292
#[cfg(test)]
293293
mod tests {
294-
use distributions::{Sample, IndependentSample};
295-
use super::{ChiSquared, StudentT, FisherF};
294+
use distributions::{IndependentSample, Sample};
295+
use super::{ChiSquared, FisherF, StudentT};
296296

297297
#[test]
298298
fn test_chi_squared_one() {

src/librand/distributions/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ use core::num::Float;
2222

2323
use core::marker::PhantomData;
2424

25-
use {Rng, Rand};
25+
use {Rand, Rng};
2626

2727
pub use self::range::Range;
28-
pub use self::gamma::{Gamma, ChiSquared, FisherF, StudentT};
29-
pub use self::normal::{Normal, LogNormal};
28+
pub use self::gamma::{ChiSquared, FisherF, Gamma, StudentT};
29+
pub use self::normal::{LogNormal, Normal};
3030
pub use self::exponential::Exp;
3131

3232
pub mod range;
@@ -266,8 +266,8 @@ fn ziggurat<R: Rng, P, Z>(rng: &mut R,
266266

267267
#[cfg(test)]
268268
mod tests {
269-
use {Rng, Rand};
270-
use super::{RandSample, WeightedChoice, Weighted, Sample, IndependentSample};
269+
use {Rand, Rng};
270+
use super::{IndependentSample, RandSample, Sample, Weighted, WeightedChoice};
271271

272272
#[derive(PartialEq, Debug)]
273273
struct ConstRand(usize);

0 commit comments

Comments
 (0)