Skip to content

Commit ae1f822

Browse files
committed
Auto merge of #1635 - Eijebong:rand, r=sgrif
Remove rand 0.3 from the dependencies
2 parents a0b36cd + 2de70de commit ae1f822

File tree

4 files changed

+30
-59
lines changed

4 files changed

+30
-59
lines changed

Cargo.lock

Lines changed: 21 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ rustdoc-args = [
3030
[dependencies]
3131
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
3232
old_semver = { path = "src/old_semver", version = "0.1.0" }
33-
rand = "0.3"
33+
rand = "0.6"
3434
git2 = "0.6.4"
3535
flate2 = "1.0"
3636
semver = { version = "0.9", git = "https://github.com/steveklabnik/semver.git", features = ["diesel", "serde"] }

src/bin/populate.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use cargo_registry::{db, schema::version_downloads};
1010
use std::env;
1111

1212
use diesel::prelude::*;
13-
use rand::{Rng, StdRng};
13+
use rand::{thread_rng, Rng};
1414

1515
fn main() {
1616
let conn = db::connect_now().unwrap();
@@ -24,7 +24,7 @@ fn update(conn: &PgConnection) -> QueryResult<()> {
2424
.skip(1)
2525
.filter_map(|arg| arg.parse::<i32>().ok());
2626
for id in ids {
27-
let mut rng = StdRng::new().unwrap();
27+
let mut rng = thread_rng();
2828
let mut dls = rng.gen_range(5_000i32, 10_000);
2929

3030
for day in 0..90 {

src/controllers/user/session.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::controllers::prelude::*;
22

33
use crate::github;
44
use conduit_cookie::RequestSession;
5+
use rand::distributions::Alphanumeric;
56
use rand::{thread_rng, Rng};
67

78
use crate::models::{NewUser, User};
@@ -23,7 +24,11 @@ use crate::models::{NewUser, User};
2324
/// ```
2425
pub fn github_authorize(req: &mut dyn Request) -> CargoResult<Response> {
2526
// Generate a random 16 char ASCII string
26-
let state: String = thread_rng().gen_ascii_chars().take(16).collect();
27+
let mut rng = thread_rng();
28+
let state: String = std::iter::repeat(())
29+
.map(|()| rng.sample(Alphanumeric))
30+
.take(16)
31+
.collect();
2732
req.session()
2833
.insert("github_oauth_state".to_string(), state.clone());
2934

0 commit comments

Comments
 (0)