Skip to content

Commit 5b9edb6

Browse files
authored
Merge pull request abonander#117 from FauxFaux/bump-rand
Bump rand, pin lazy_static
2 parents cc1741b + a85f77b commit 5b9edb6

File tree

6 files changed

+12
-16
lines changed

6 files changed

+12
-16
lines changed

.travis.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ branches:
44
except:
55
- fuzzing
66
rust:
7-
- 1.26.1
7+
- 1.22.1
88
- stable
99
- beta
1010
- nightly
@@ -16,19 +16,13 @@ env:
1616
- RUST_LOG=multipart=trace RUST_BACKTRACE=1 ARGS=
1717
matrix:
1818
include:
19-
- rust: 1.22.1
2019
- rust: stable
2120
env: ARGS+=--no-default-features --features "nickel"
2221
- rust: stable
2322
env: ARGS+=--features "use_arc_str"
2423
- rust: nightly
2524
env: ARGS+=--features "nightly,rocket"
2625
script:
27-
- |
28-
if [ ${TRAVIS_RUST_VERSION} = "1.22.1" ]; then
29-
# we can't test because `env_logger` uses `lazy_static 1.2.0` which needs Rust 1.26
30-
cargo build --no-default-features --features "mock,client,server" && exit 0;
31-
fi
3226
- cargo build --verbose $ARGS;
3327
- cargo test --verbose $ARGS -- --test-threads=1;
3428
- cargo doc --verbose $ARGS;

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ license = "MIT OR Apache-2.0"
1818
readme = "README.md"
1919

2020
[dependencies]
21+
# lazy-static (pulled in by e.g. nickel, regex) is incompatible with 1.22.1
22+
lazy_static = { version = ">=1.0,<1.2.0", optional = true }
2123
log = "0.4"
2224
mime = "0.2"
2325
mime_guess = "1.8"
24-
rand = "0.4"
26+
rand = "0.6"
2527
safemem = { version = "0.3", optional = true }
2628
tempdir = "0.3"
2729
clippy = { version = ">=0.0, <0.1", optional = true}

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@ Client- and server-side abstractions for HTTP file uploads (POST requests with
55
Supports several different (**sync**hronous API) HTTP crates.
66
**Async**hronous (i.e. `futures`-based) API support will be provided by [multipart-async].
77

8-
Minimum supported Rust version: 1.22.1*
9-
* only `mock`, `client` and `server` features, only guaranteed to compile
10-
11-
Fully tested Rust version: 1.26.1
8+
Minimum supported Rust version: 1.22.1
129

1310
### [Documentation](http://docs.rs/multipart/)
1411

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub mod server;
119119
mod local_test;
120120

121121
fn random_alphanumeric(len: usize) -> String {
122-
rand::thread_rng().gen_ascii_chars().take(len).collect()
122+
rand::thread_rng().sample_iter(&rand::distributions::Alphanumeric).take(len).collect()
123123
}
124124

125125
#[cfg(test)]

src/local_test.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,16 +301,18 @@ fn gen_bool() -> bool {
301301
}
302302

303303
fn gen_string() -> String {
304+
use rand::distributions::Alphanumeric;
305+
304306
let mut rng_1 = rand::thread_rng();
305307
let mut rng_2 = rand::thread_rng();
306308

307309
let str_len_1 = rng_1.gen_range(MIN_LEN, MAX_LEN + 1);
308310
let str_len_2 = rng_2.gen_range(MIN_LEN, MAX_LEN + 1);
309311
let num_dashes = rng_1.gen_range(0, MAX_DASHES + 1);
310312

311-
rng_1.gen_ascii_chars().take(str_len_1)
313+
rng_1.sample_iter(&Alphanumeric).take(str_len_1)
312314
.chain(iter::repeat('-').take(num_dashes))
313-
.chain(rng_2.gen_ascii_chars().take(str_len_2))
315+
.chain(rng_2.sample_iter(&Alphanumeric).take(str_len_2))
314316
.collect()
315317
}
316318

src/mock.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use std::cell::{Cell, RefCell};
99
use std::io::{self, Read, Write};
1010
use std::{fmt, thread};
1111

12-
use rand::{self, Rng, ThreadRng};
12+
use rand::{self, Rng};
13+
use rand::prelude::ThreadRng;
1314

1415
/// A mock implementation of `client::HttpRequest` which can spawn an `HttpBuffer`.
1516
///

0 commit comments

Comments
 (0)