MCPcopy Index your code
hub / github.com/assert-rs/assert_cmd / missing_cargo_bin

Function missing_cargo_bin

src/cargo.rs:251–273  ·  view source on GitHub ↗
(name: &str)

Source from the content-addressed store, hash-verified

249
250#[track_caller]
251fn missing_cargo_bin(name: &str) -> ! {
252 let possible_names: Vec<_> = env::vars_os()
253 .filter_map(|(k, _)| k.into_string().ok())
254 .filter_map(|k| k.strip_prefix(CARGO_BIN_EXE_).map(|s| s.to_owned()))
255 .collect();
256 if possible_names.is_empty() {
257 panic!("`CARGO_BIN_EXE_{name}` is unset
258help: if this is running within a unit test, move it to an integration test to gain access to `CARGO_BIN_EXE_{name}`")
259 } else {
260 let mut names = String::new();
261 for (i, name) in possible_names.iter().enumerate() {
262 use std::fmt::Write as _;
263 if i != 0 {
264 let _ = write!(&mut names, ", ");
265 }
266 let _ = write!(&mut names, "\"{name}\"");
267 }
268 panic!(
269 "`CARGO_BIN_EXE_{name}` is unset
270help: available binary names are {names}"
271 )
272 }
273}
274
275fn legacy_cargo_bin(name: &str) -> Option<path::PathBuf> {
276 let target_dir = target_dir()?;

Callers 1

cargo_bin_strFunction · 0.85

Calls 1

okMethod · 0.45

Tested by

no test coverage detected