Skip to content

Commit

Permalink
style: Address warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed May 2, 2024
1 parent 5de0c77 commit 310cca6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/cargo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub(crate) fn cargo_runner() -> Option<Vec<String>> {
"CARGO_TARGET_{}_RUNNER",
CURRENT_TARGET.replace('-', "_").to_uppercase()
);
let runner = std::env::var(runner_env).ok()?;
let runner = env::var(runner_env).ok()?;
Some(runner.split(' ').map(str::to_string).collect())
}

Expand Down Expand Up @@ -223,7 +223,7 @@ pub fn cargo_bin<S: AsRef<str>>(name: S) -> path::PathBuf {

fn cargo_bin_str(name: &str) -> path::PathBuf {
let env_var = format!("CARGO_BIN_EXE_{}", name);
std::env::var_os(env_var)
env::var_os(env_var)
.map(|p| p.into())
.unwrap_or_else(|| target_dir().join(format!("{}{}", name, env::consts::EXE_SUFFIX)))
}
Expand Down
4 changes: 2 additions & 2 deletions src/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,10 +402,10 @@ fn format_bytes(data: &[u8], f: &mut impl fmt::Write) -> fmt::Result {
}

fn write_debug_bstrs<'a>(
f: &mut impl std::fmt::Write,
f: &mut impl fmt::Write,
multiline: bool,
mut lines: impl Iterator<Item = &'a [u8]>,
) -> std::fmt::Result {
) -> fmt::Result {
if multiline {
writeln!(f, "```")?;
for mut line in lines {
Expand Down
5 changes: 2 additions & 3 deletions tests/cargo.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
use std::process;
use std::process::Command;

use assert_cmd::prelude::*;
use escargot::CURRENT_TARGET;

#[test]
fn cargo_binary() {
let mut cmd = process::Command::cargo_bin("bin_fixture").unwrap();
let mut cmd = Command::cargo_bin("bin_fixture").unwrap();
cmd.env("stdout", "42");
cmd.assert().success().stdout("42\n");
}

#[test]
fn cargo_binary_with_empty_env() {
let mut cmd = process::Command::cargo_bin("bin_fixture").unwrap();
let mut cmd = Command::cargo_bin("bin_fixture").unwrap();
cmd.env_clear().env("stdout", "42");
cmd.assert().success().stdout("42\n");
}
Expand Down

0 comments on commit 310cca6

Please sign in to comment.