diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5e87dd..b41f2bc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: include: - build: pinned os: ubuntu-18.04 - rust: 1.34.0 + rust: 1.46.0 - build: stable os: ubuntu-18.04 rust: stable diff --git a/README.md b/README.md index de2cec9..b360c04 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ default and thus no longer available. ### Minimum Rust version policy -This crate's minimum supported `rustc` version is `1.34.0`. +This crate's minimum supported `rustc` version is `1.46.0`. The current policy is that the minimum Rust version required to use this crate can be increased in minor version updates. For example, if `crate 1.0` requires diff --git a/examples/btree_set_range.rs b/examples/btree_set_range.rs index a89ffa5..0e7418b 100644 --- a/examples/btree_set_range.rs +++ b/examples/btree_set_range.rs @@ -1,9 +1,8 @@ -extern crate quickcheck; - -use quickcheck::{quickcheck, TestResult}; use std::collections::BTreeSet; use std::ops::Bound::{self, *}; +use quickcheck::{quickcheck, TestResult}; + /// Covers every `std::ops::Range*` plus variants with exclusive start. type RangeAny = (Bound, Bound); @@ -11,6 +10,7 @@ type RangeAny = (Bound, Bound); trait RangeBounds { fn contains(&self, _: &T) -> bool; } + impl RangeBounds for RangeAny { fn contains(&self, item: &T) -> bool { (match &self.0 { diff --git a/examples/out_of_bounds.rs b/examples/out_of_bounds.rs index f17519c..10da938 100644 --- a/examples/out_of_bounds.rs +++ b/examples/out_of_bounds.rs @@ -1,5 +1,3 @@ -extern crate quickcheck; - use quickcheck::{quickcheck, TestResult}; fn main() { diff --git a/examples/reverse.rs b/examples/reverse.rs index ffbd2b7..fff6e71 100644 --- a/examples/reverse.rs +++ b/examples/reverse.rs @@ -1,5 +1,3 @@ -extern crate quickcheck; - use quickcheck::quickcheck; fn reverse(xs: &[T]) -> Vec { diff --git a/examples/reverse_single.rs b/examples/reverse_single.rs index 2384f9c..6112509 100644 --- a/examples/reverse_single.rs +++ b/examples/reverse_single.rs @@ -1,5 +1,3 @@ -extern crate quickcheck; - use quickcheck::{quickcheck, TestResult}; fn reverse(xs: &[T]) -> Vec { diff --git a/examples/sieve.rs b/examples/sieve.rs index 2079d56..f05b8e3 100644 --- a/examples/sieve.rs +++ b/examples/sieve.rs @@ -1,5 +1,3 @@ -extern crate quickcheck; - use quickcheck::quickcheck; fn sieve(n: usize) -> Vec { diff --git a/examples/sort.rs b/examples/sort.rs index d85d4ba..0f495a0 100644 --- a/examples/sort.rs +++ b/examples/sort.rs @@ -1,16 +1,14 @@ // This is a buggy quick sort implementation, QuickCheck will find the bug for // you. -extern crate quickcheck; - use quickcheck::quickcheck; fn smaller_than(xs: &[T], pivot: &T) -> Vec { - return xs.iter().filter(|&x| *x < *pivot).map(|x| x.clone()).collect(); + xs.iter().filter(|&x| *x < *pivot).map(|x| x.clone()).collect() } fn larger_than(xs: &[T], pivot: &T) -> Vec { - return xs.iter().filter(|&x| *x > *pivot).map(|x| x.clone()).collect(); + xs.iter().filter(|&x| *x > *pivot).map(|x| x.clone()).collect() } fn sortk(x: &T, xs: &[T]) -> Vec { diff --git a/src/lib.rs b/src/lib.rs index 34900ac..4202afb 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,12 +6,6 @@ #![cfg_attr(feature = "i128", feature(i128_type, i128))] -#[cfg(feature = "use_logging")] -extern crate env_logger; -#[cfg(feature = "use_logging")] -#[macro_use] -extern crate log; - pub use crate::arbitrary::{empty_shrinker, single_shrinker, Arbitrary, Gen}; pub use crate::tester::{quickcheck, QuickCheck, TestResult, Testable}; @@ -68,6 +62,12 @@ macro_rules! quickcheck { fn env_logger_init() -> Result<(), log::SetLoggerError> { env_logger::try_init() } +#[cfg(feature = "use_logging")] +macro_rules! info { + ($($tt:tt)*) => { + log::info!($($tt)*) + }; +} #[cfg(not(feature = "use_logging"))] fn env_logger_init() {}