Repository: cksac/fake-rs (language: rust)

Issue:
version 2.4.2 not buildable with semver 1.x
It looks like the version of the semver crate was bumped from 0.11 to 1 with the last update (2.4.1 → 2.4.2). But when enabling the semver feature, it becomes apparent that the code was not updated for breaking changes between semver 0.11 and 1 at all:

```
error[E0603]: struct `Identifier` is private
   --> src/impls/semver/mod.rs:16:32
    |
16  |             pre = vec!(semver::Identifier::AlphaNumeric(format!(
    |                                ^^^^^^^^^^ private struct
    |
note: the struct `Identifier` is defined here
   --> /usr/share/cargo/registry/semver-1.0.4/src/lib.rs:103:5
    |
103 | use crate::identifier::Identifier;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0599]: no associated item named `AlphaNumeric` found for struct `semver::identifier::Identifier` in the current scope
  --> src/impls/semver/mod.rs:16:44
   |
16 |             pre = vec!(semver::Identifier::AlphaNumeric(format!(
   |                                            ^^^^^^^^^^^^ associated item not found in `semver::identifier::Identifier`

error[E0308]: mismatched types
  --> src/impls/semver/mod.rs:28:18
   |
28 |             pre: pre,
   |                  ^^^ expected struct `Prerelease`, found struct `Vec`
   |
   = note: expected struct `Prerelease`
              found struct `Vec<_>`

error[E0308]: mismatched types
  --> src/impls/semver/mod.rs:29:20
   |
29 |             build: vec!(),
   |                    ^^^^^^ expected struct `BuildMetadata`, found struct `Vec`
   |
   = note: expected struct `BuildMetadata`
              found struct `Vec<_>`
   = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0308, E0599, E0603.
For more information about an error, try `rustc --explain E0308`.
error: could not compile `fake` due to 4 previous errors
```


Discussion / hints:

Fix patch:
diff --git a/fake/Cargo.toml b/fake/Cargo.toml
index 8c5599d..b4ccc4d 100644
--- a/fake/Cargo.toml
+++ b/fake/Cargo.toml
@@ -1,6 +1,6 @@
 [package]
 name = "fake"
-version = "2.4.2"
+version = "2.4.3"
 authors = ["cksac <cs.cksac@gmail.com>"]
 description = "An easy to use library for generating fake data like name, number, address, lorem, dates, etc."
 keywords = ["faker", "data", "generator", "random"]
diff --git a/fake/src/impls/semver/mod.rs b/fake/src/impls/semver/mod.rs
index 41e7cf5..827f9a3 100644
--- a/fake/src/impls/semver/mod.rs
+++ b/fake/src/impls/semver/mod.rs
@@ -11,22 +11,21 @@ const UNSTABLE_SEMVER: &'static [&'static str] = &[
 impl Dummy<Faker> for semver::Version {
     fn dummy_with_rng<R: Rng + ?Sized>(_: &Faker, rng: &mut R) -> Self {
         let probability = 10;
-        let pre;
-        if Boolean(EN, probability).fake_with_rng(rng) {
-            pre = vec!(semver::Identifier::AlphaNumeric(format!(
+        let pre = if Boolean(EN, probability).fake_with_rng(rng) {
+            semver::Prerelease::new(&format!(
                 "{}.{}",
                 *UNSTABLE_SEMVER.choose(rng).unwrap(),
                 &(0..9).fake_with_rng::<u8, _>(rng).to_string()
-            )));
+            )).unwrap()
         } else {
-            pre = vec!();
-        }
+            semver::Prerelease::EMPTY
+        };
         semver::Version {
             major: (0..9).fake_with_rng::<u64, _>(rng),
             minor: (0..20).fake_with_rng::<u64, _>(rng),
             patch: (0..20).fake_with_rng::<u64, _>(rng),
             pre: pre,
-            build: vec!(),
+            build: semver::BuildMetadata::EMPTY,
         }
     }
 }


Test patch: