]> git.lizzy.rs Git - rust.git/blobdiff - src/librand/chacha.rs
Only retain external static symbols across LTO
[rust.git] / src / librand / chacha.rs
index 411ca8360805440c215a76c437a461558d6e0fdf..cd099c69005f3a1ece79fad054ef70c48b7bdfd4 100644 (file)
@@ -12,8 +12,8 @@
 
 use {Rng, SeedableRng, Rand};
 
-const KEY_WORDS    : usize =  8; // 8 words for the 256-bit key
-const STATE_WORDS  : usize = 16;
+const KEY_WORDS: usize = 8; // 8 words for the 256-bit key
+const STATE_WORDS: usize = 16;
 const CHACHA_ROUNDS: usize = 20; // Cryptographically secure from 8 upwards as of this writing
 
 /// A random number generator that uses the ChaCha20 algorithm [1].
@@ -77,7 +77,6 @@ macro_rules! double_round{
 }
 
 impl ChaChaRng {
-
     /// Create an ChaCha random number generator using the default
     /// fixed key of 8 zero words.
     pub fn new_unseeded() -> ChaChaRng {
@@ -173,7 +172,6 @@ fn next_u32(&mut self) -> u32 {
 }
 
 impl<'a> SeedableRng<&'a [u32]> for ChaChaRng {
-
     fn reseed(&mut self, seed: &'a [u32]) {
         // reset state
         self.init(&[0; KEY_WORDS]);
@@ -210,7 +208,6 @@ fn rand<R: Rng>(other: &mut R) -> ChaChaRng {
 mod tests {
     use std::prelude::v1::*;
 
-    use core::iter::order;
     use {Rng, SeedableRng};
     use super::ChaChaRng;
 
@@ -219,8 +216,8 @@ fn test_rng_rand_seeded() {
         let s = ::test::rng().gen_iter::<u32>().take(8).collect::<Vec<u32>>();
         let mut ra: ChaChaRng = SeedableRng::from_seed(&*s);
         let mut rb: ChaChaRng = SeedableRng::from_seed(&*s);
-        assert!(order::equals(ra.gen_ascii_chars().take(100),
-                              rb.gen_ascii_chars().take(100)));
+        assert!(ra.gen_ascii_chars().take(100)
+                  .eq(rb.gen_ascii_chars().take(100)));
     }
 
     #[test]
@@ -228,8 +225,8 @@ fn test_rng_seeded() {
         let seed: &[_] = &[0, 1, 2, 3, 4, 5, 6, 7];
         let mut ra: ChaChaRng = SeedableRng::from_seed(seed);
         let mut rb: ChaChaRng = SeedableRng::from_seed(seed);
-        assert!(order::equals(ra.gen_ascii_chars().take(100),
-                              rb.gen_ascii_chars().take(100)));
+        assert!(ra.gen_ascii_chars().take(100)
+                  .eq(rb.gen_ascii_chars().take(100)));
     }
 
     #[test]