Skip to content

Commit 67a1fe4

Browse files
authored
Merge pull request #606 from proptest-rs/fix-test
fix doctest and cleanup warnings
2 parents c1a49e6 + 7190be9 commit 67a1fe4

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ rand_xorshift = "0.4"
3333
regex = "1.0"
3434
regex-syntax = "0.8"
3535
rusty-fork = { version = "0.3.0", default-features = false }
36-
syn = "2.0.100"
36+
syn = "2.0.108"
3737
tempfile = "3.0"
38-
trybuild = "=1.0.90"
38+
trybuild = "=1.0.112"
3939
unarray = "0.1.4"
4040
x86 = "0.52.0"

proptest-derive/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ impl ToTokens for MapClosure {
825825

826826
/// Construct a `FreshVar` with the given `prefix` and the number it has in the
827827
/// count of temporaries for that prefix.
828-
fn fresh_var(prefix: &str, count: usize) -> FreshVar {
828+
fn fresh_var(prefix: &str, count: usize) -> FreshVar<'_> {
829829
FreshVar { prefix, count }
830830
}
831831

proptest/src/num.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ macro_rules! signed_integer_bin_search {
238238
($typ:ident, $int_any: ident, $uniform: ident, $incl: ident) => {
239239
#[allow(missing_docs)]
240240
pub mod $typ {
241+
#[allow(unused_imports)]
241242
use rand::{Rng, RngCore};
242243

243244
use crate::strategy::*;
@@ -343,6 +344,7 @@ macro_rules! unsigned_integer_bin_search {
343344
($typ:ident, $int_any: ident, $uniform: ident, $incl: ident) => {
344345
#[allow(missing_docs)]
345346
pub mod $typ {
347+
#[allow(unused_imports)]
346348
use rand::{Rng, RngCore};
347349

348350
use crate::strategy::*;

proptest/src/test_runner/errors.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,20 @@ pub trait ProptestResultExt<T, E>: private::Sealed {
153153
///
154154
/// ```
155155
/// use proptest::prelude::*;
156-
/// proptest! {
157-
/// #[test]
158-
/// fn test_that_only_works_with_positive_integers(a in -10i32..10i32) {
156+
///
157+
/// fn test_conversion(a: i32) -> Result<(), TestCaseError> {
159158
/// // Reject the case if `a` cannot be converted to u8 (e.g., negative values)
160159
/// let _unsigned: u8 = a.try_into().prop_assume_ok()?;
161160
/// // ...rest of test...
161+
/// Ok(())
162+
/// }
163+
///
164+
/// proptest! {
165+
/// #[test]
166+
/// fn test_that_only_works_with_positive_integers(a in -10i32..10i32) {
167+
/// test_conversion(a)?;
162168
/// }
163169
/// }
164-
/// #
165-
/// # fn main() { test_signed_to_unsigned(); }
166170
/// ```
167171
///
168172
/// [`prop_assume!`]: crate::prop_assume

0 commit comments

Comments
 (0)