Skip to content

Commit

Permalink
deps: update to quickcheck 0.7
Browse files Browse the repository at this point in the history
This also updates the rand crate.

We bump the minimum Rust version to the latest stable, Rust 1.28.0.

See: BurntSushi/ripgrep#1019
  • Loading branch information
BurntSushi committed Aug 25, 2018
1 parent bc730d7 commit 5c5c538
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 19 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ matrix:
env: TARGET=x86_64-unknown-linux-musl
# Minimum Rust supported channel.
- os: linux
rust: 1.20.0
rust: 1.28.0
env: TARGET=x86_64-unknown-linux-gnu
- os: linux
rust: 1.20.0
rust: 1.28.0
env: TARGET=x86_64-unknown-linux-musl

before_install:
Expand Down
39 changes: 34 additions & 5 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repository = "https://github.com/BurntSushi/xsv"
readme = "README.md"
keywords = ["csv", "tsv", "slice", "command"]
license = "Unlicense/MIT"
autotests = false

[[bin]]
name = "xsv"
Expand All @@ -34,7 +35,7 @@ csv-index = "0.1.5"
docopt = "1"
filetime = "0.1"
num_cpus = "1.4"
rand = "0.4"
rand = "0.5"
regex = "1"
serde = "1"
serde_derive = "1"
Expand All @@ -43,5 +44,5 @@ tabwriter = "1"
threadpool = "1.3"

[dev-dependencies]
quickcheck = { version = "0.6", default-features = false }
quickcheck = { version = "0.7", default-features = false }
log = "0.4"
18 changes: 9 additions & 9 deletions src/cmd/sample.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
use std::io;

use byteorder::{ByteOrder, LittleEndian};
use csv;
use rand::{Rng, SeedableRng, StdRng};
use rand::{self, Rng, SeedableRng};
use rand::rngs::StdRng;

use CliResult;
use config::{Config, Delimiter};
Expand Down Expand Up @@ -115,15 +117,13 @@ fn sample_reservoir<R: io::Read>(

// Seeding rng
let mut rng: StdRng = match seed {
Some(s) => {
SeedableRng::from_seed(&[s][..])
}
None => {
let s = ::rand::thread_rng()
.gen_iter()
.take(256)
.collect::<Vec<usize>>();
SeedableRng::from_seed(&s[..])
StdRng::from_rng(rand::thread_rng()).unwrap()
}
Some(seed) => {
let mut buf = [0u8; 32];
LittleEndian::write_u64(&mut buf, seed as u64);
SeedableRng::from_seed(buf)
}
};

Expand Down
2 changes: 1 addition & 1 deletion tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::mem::transmute;
use std::ops;

use quickcheck::{Arbitrary, Gen, QuickCheck, StdGen, Testable};
use rand::thread_rng;
use rand::{Rng, thread_rng};

macro_rules! svec[
($($x:expr),*) => (
Expand Down

0 comments on commit 5c5c538

Please sign in to comment.