Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deps #90

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 32 additions & 49 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ thirsty = []
yikes = []

[dependencies]
fastrand = "1.8.0"
fastrand = "2"

[build-dependencies]
serde = { version = "1.0.151", features = ["derive"] }
Expand Down
22 changes: 11 additions & 11 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() {
}

fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
let rng = Rng::new();
let mut rng = Rng::new();

let mut arg_iter = env::args().peekable();

Expand Down Expand Up @@ -69,7 +69,7 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
if let Ok(limit) = env::var(RECURSION_LIMIT_VAR) {
if let Ok(n) = limit.parse::<u8>() {
if n > RECURSION_LIMIT {
let mut response = select_response(&true_role, &rng, ResponseType::Overflow);
let mut response = select_response(&true_role, &mut rng, ResponseType::Overflow);
match &mut response {
Ok(s) | Err(s) => {
*s += "\nyou didn't set CARGO to something naughty, did you?\n"
Expand Down Expand Up @@ -137,8 +137,8 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
if let Err(e) = std::fs::copy(bin_path, new_bin_path) {
Err(format!(
"{role} couldn't copy {pronoun}self...\n{e:?}",
role = ROLE.load(&true_role, &rng)?,
pronoun = PRONOUN.load(&true_role, &rng)?,
role = ROLE.load(&true_role, &mut rng)?,
pronoun = PRONOUN.load(&true_role, &mut rng)?,
))?
} else {
// Just exit immediately on success, don't try to get too clever here~
Expand All @@ -148,8 +148,8 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {
} else {
Err(format!(
"{role} couldn't copy {pronoun}self...\n(couldn't find own parent dir)",
role = ROLE.load(&true_role, &rng)?,
pronoun = PRONOUN.load(&true_role, &rng)?,
role = ROLE.load(&true_role, &mut rng)?,
pronoun = PRONOUN.load(&true_role, &mut rng)?,
))?;
}
}
Expand All @@ -171,9 +171,9 @@ fn real_main() -> Result<i32, Box<dyn std::error::Error>> {

// Time for mommy to tell you how you did~
let response = if status.success() {
select_response(&true_role, &rng, ResponseType::Positive)
select_response(&true_role, &mut rng, ResponseType::Positive)
} else {
select_response(&true_role, &rng, ResponseType::Negative)
select_response(&true_role, &mut rng, ResponseType::Negative)
};
pretty_print(response);

Expand Down Expand Up @@ -205,7 +205,7 @@ fn is_quiet_mode_enabled(args: std::process::CommandArgs) -> bool {

fn select_response(
true_role: &str,
rng: &Rng,
rng: &mut Rng,
response_type: ResponseType,
) -> Result<String, String> {
// Choose what mood mommy is in~
Expand Down Expand Up @@ -263,7 +263,7 @@ impl Config<'_> {
&self,
true_role: &str,
chunks: &[Chunk],
rng: &Rng,
rng: &mut Rng,
) -> Result<String, String> {
let mut out = String::new();
for chunk in chunks {
Expand Down Expand Up @@ -299,7 +299,7 @@ struct Var<'a> {
impl Var<'_> {
/// Loads this variable and selects one of the possible values for it;
/// produces an in-character error message on failure.
fn load(&self, true_role: &str, rng: &Rng) -> Result<String, String> {
fn load(&self, true_role: &str, rng: &mut Rng) -> Result<String, String> {
// try to load custom settings from env vars~
let var = env::var(self.env(true_role));
let split;
Expand Down