mirror of https://github.com/rwf2/Rocket.git
Fix compatibility warnings and errors in examples.
This commit is contained in:
parent
5c54335cbb
commit
ae3d9bb664
|
@ -4,6 +4,6 @@ version = "0.0.0"
|
||||||
workspace = "../.."
|
workspace = "../.."
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
crossbeam = "*"
|
crossbeam = "0.4"
|
||||||
rocket = { path = "../../lib" }
|
rocket = { path = "../../lib" }
|
||||||
rocket_codegen = { path = "../../codegen" }
|
rocket_codegen = { path = "../../codegen" }
|
||||||
|
|
|
@ -6,7 +6,7 @@ extern crate rocket;
|
||||||
|
|
||||||
#[cfg(test)] mod tests;
|
#[cfg(test)] mod tests;
|
||||||
|
|
||||||
use crossbeam::sync::MsQueue;
|
use crossbeam::queue::MsQueue;
|
||||||
use rocket::State;
|
use rocket::State;
|
||||||
|
|
||||||
#[derive(FromForm, Debug)]
|
#[derive(FromForm, Debug)]
|
||||||
|
|
|
@ -6,4 +6,4 @@ workspace = "../../"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { path = "../../lib" }
|
rocket = { path = "../../lib" }
|
||||||
rocket_codegen = { path = "../../codegen" }
|
rocket_codegen = { path = "../../codegen" }
|
||||||
rand = "0.3"
|
rand = "0.5"
|
||||||
|
|
|
@ -3,7 +3,7 @@ use std::borrow::Cow;
|
||||||
|
|
||||||
use rocket::request::FromParam;
|
use rocket::request::FromParam;
|
||||||
use rocket::http::RawStr;
|
use rocket::http::RawStr;
|
||||||
use rand::{self, Rng};
|
use rand::{self, RngCore};
|
||||||
|
|
||||||
/// Table to retrieve base62 values from.
|
/// Table to retrieve base62 values from.
|
||||||
const BASE62: &'static [u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
const BASE62: &'static [u8] = b"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
||||||
|
@ -20,7 +20,7 @@ impl<'a> PasteID<'a> {
|
||||||
let mut id = String::with_capacity(size);
|
let mut id = String::with_capacity(size);
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
for _ in 0..size {
|
for _ in 0..size {
|
||||||
id.push(BASE62[rng.gen::<usize>() % 62] as char);
|
id.push(BASE62[(rng.next_u32() % 62) as usize] as char);
|
||||||
}
|
}
|
||||||
|
|
||||||
PasteID(Cow::Owned(id))
|
PasteID(Cow::Owned(id))
|
||||||
|
|
|
@ -14,7 +14,7 @@ dotenv = "0.10"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
parking_lot = {version = "0.4", features = ["nightly"]}
|
parking_lot = {version = "0.4", features = ["nightly"]}
|
||||||
rand = "0.3"
|
rand = "0.5"
|
||||||
|
|
||||||
[dependencies.rocket_contrib]
|
[dependencies.rocket_contrib]
|
||||||
path = "../../contrib"
|
path = "../../contrib"
|
||||||
|
|
|
@ -3,7 +3,7 @@ extern crate rand;
|
||||||
|
|
||||||
use super::task::Task;
|
use super::task::Task;
|
||||||
use self::parking_lot::Mutex;
|
use self::parking_lot::Mutex;
|
||||||
use self::rand::{Rng, thread_rng};
|
use self::rand::{Rng, thread_rng, distributions::Alphanumeric};
|
||||||
|
|
||||||
use rocket::local::Client;
|
use rocket::local::Client;
|
||||||
use rocket::http::{Status, ContentType};
|
use rocket::http::{Status, ContentType};
|
||||||
|
@ -90,7 +90,7 @@ fn test_many_insertions() {
|
||||||
|
|
||||||
for i in 0..ITER {
|
for i in 0..ITER {
|
||||||
// Issue a request to insert a new task with a random description.
|
// Issue a request to insert a new task with a random description.
|
||||||
let desc: String = rng.gen_ascii_chars().take(12).collect();
|
let desc: String = rng.sample_iter(&Alphanumeric).take(12).collect();
|
||||||
client.post("/todo")
|
client.post("/todo")
|
||||||
.header(ContentType::Form)
|
.header(ContentType::Form)
|
||||||
.body(format!("description={}", desc))
|
.body(format!("description={}", desc))
|
||||||
|
|
Loading…
Reference in New Issue