Skip to content

Commit

Permalink
remove unused 'frunk' feature and add From's for SizeRange and Probab…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
matthew-russo committed Aug 24, 2024
1 parent 8d1e12f commit c4685bc
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 98 deletions.
15 changes: 3 additions & 12 deletions proptest/src/collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,18 +165,9 @@ impl From<RangeToInclusive<usize>> for SizeRange {
}
}

#[cfg(feature = "frunk")]
impl Generic for SizeRange {
type Repr = RangeInclusive<usize>;

/// Converts the `SizeRange` into `Range<usize>`.
fn into(self) -> Self::Repr {
self.0
}

/// Converts `RangeInclusive<usize>` into `SizeRange`.
fn from(r: Self::Repr) -> Self {
r.into()
impl From<SizeRange> for Range<usize> {
fn from(size_range: SizeRange) -> Self {
size_range.0
}
}

Expand Down
9 changes: 0 additions & 9 deletions proptest/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,6 @@ extern crate std;
#[macro_use]
extern crate alloc;

#[cfg(feature = "frunk")]
#[macro_use]
extern crate frunk_core;

#[cfg(feature = "frunk")]
#[macro_use]
mod product_frunk;

#[cfg(not(feature = "frunk"))]
#[macro_use]
mod product_tuple;

Expand Down
28 changes: 3 additions & 25 deletions proptest/src/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,6 @@ impl Default for Probability {
}
}

impl From<f64> for Probability {
/// Creates a `Probability` from a `f64`.
///
/// # Panics
///
/// Panics if the probability is outside interval `[0.0, 1.0]`.
fn from(prob: f64) -> Self {
Probability::new(prob)
}
}

impl Probability {
/// Creates a `Probability` from a `f64`.
///
Expand Down Expand Up @@ -81,25 +70,14 @@ impl Probability {
}
}

#[cfg(feature = "frunk")]
use frunk_core::generic::Generic;

#[cfg(feature = "frunk")]
impl Generic for Probability {
type Repr = f64;

/// Converts the `Probability` into an `f64`.
fn into(self) -> Self::Repr {
self.0
}

impl From<f64> for Probability {
/// Creates a `Probability` from a `f64`.
///
/// # Panics
///
/// Panics if the probability is outside interval `[0.0, 1.0]`.
fn from(r: Self::Repr) -> Self {
r.into()
fn from(prob: f64) -> Self {
Probability::new(prob)
}
}

Expand Down
49 changes: 0 additions & 49 deletions proptest/src/product_frunk.rs

This file was deleted.

4 changes: 1 addition & 3 deletions proptest/src/product_tuple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@
// except according to those terms.

//! Defines macros for product type creation, extraction, and the type signature
//! itself. This version uses tuples. This mechanism is used to be very
//! loosely coupled with `frunk_core` so that only `lib.rs` has to be changed
//! in the event that Rust gets tuple-variadic generics.
//! itself. This version uses tuples.
macro_rules! product_type {
($factor: ty) => {
Expand Down

0 comments on commit c4685bc

Please sign in to comment.