Skip to content

Remove rand 0.3 from the dependencies #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 21 additions & 55 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ rustdoc-args = [
[dependencies]
cargo-registry-s3 = { path = "src/s3", version = "0.2.0" }
old_semver = { path = "src/old_semver", version = "0.1.0" }
rand = "0.3"
rand = "0.6"
git2 = "0.6.4"
flate2 = "1.0"
semver = { version = "0.9", git = "https://github.com/steveklabnik/semver.git", features = ["diesel", "serde"] }
Expand Down
4 changes: 2 additions & 2 deletions src/bin/populate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use cargo_registry::{db, schema::version_downloads};
use std::env;

use diesel::prelude::*;
use rand::{Rng, StdRng};
use rand::{thread_rng, Rng};

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

for day in 0..90 {
Expand Down
7 changes: 6 additions & 1 deletion src/controllers/user/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::controllers::prelude::*;

use crate::github;
use conduit_cookie::RequestSession;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};

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

Expand Down