Skip to content

Commit

Permalink
chore(deps): bump petname to 2.0.2 (#325)
Browse files Browse the repository at this point in the history
* chore(deps): bump petname to 2.0.2

This change also uses the large word list due to #312.
fixes #324

* Update src/random.rs

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>

* style: cargo fmt

---------

Co-authored-by: Orhun Parmaksız <orhunparmaksiz@gmail.com>
  • Loading branch information
tessus and orhun authored Aug 3, 2024
1 parent 22162c0 commit 1c55919
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 9 deletions.
20 changes: 16 additions & 4 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ shuttle-runtime = { version = "0.47.0", optional = true }
awc = { version = "3.5.0" }
serde = "1.0.204"
futures-util = "0.3.30"
petname = { version = "1.1.3", default-features = false, features = [
"std_rng",
"default_dictionary",
petname = { version = "2.0.2", default-features = false, features = [
"default-rng",
"default-words",
] }
rand = "0.8.5"
dotenvy = "0.15.7"
Expand Down
5 changes: 3 additions & 2 deletions src/random.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use petname::Generator;
use rand::{distributions::Alphanumeric, Rng};

/// Random URL configuration.
Expand Down Expand Up @@ -27,10 +28,10 @@ impl RandomURLConfig {
return None;
}
Some(match self.type_ {
RandomURLType::PetName => petname::petname(
RandomURLType::PetName => petname::Petnames::large().generate_one(
self.words.unwrap_or(2),
self.separator.as_deref().unwrap_or("-"),
),
)?,
RandomURLType::Alphanumeric => rand::thread_rng()
.sample_iter(&Alphanumeric)
.take(self.length.unwrap_or(8))
Expand Down

0 comments on commit 1c55919

Please sign in to comment.