Cargo_bin! deprecated

⚓ Rust    📅 2025-11-07    👤 surdeus    👁️ 9      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Cargo_bin! deprecated

I am very confused by this error message

Warning: use of deprecated function `assert_cmd::cargo::cargo_bin`: incompatible with a custom cargo build-dir, see instead `cargo::cargo_bin!`
 --> horned-bin/tests/test_horned_validate.rs:1:24
  |
1 | use assert_cmd::cargo::cargo_bin;
  |                        ^^^^^^^^^

I have been trying to update my code to remove a deprecation warning message.

I have previously been using Command in assert_cmd::cmd - Rust which has clearly been deprecated. So, I have updated by code to use cargo_bin! as suggested. It now looks like this:

use assert_cmd::cargo::cargo_bin;
use assert_cmd::prelude::*; // Add methods on commands
use std::process::Command; // Run programs

#[test]
fn integration_validate_ontology_rdf() -> Result<(), Box<dyn std::error::Error>> {
    let mut cmd = Command::new(cargo_bin!("horned-validate"));

    cmd.arg("../src/ont/owl-rdf/and.owl");
    cmd.assert().success();

    Ok(())
}

#[test]
fn integration_validate_ontology_xml() -> Result<(), Box<dyn std::error::Error>> {
    let mut cmd = Command::new(cargo_bin!("horned-validate"));

    cmd.arg("../src/ont/owl-xml/and.owx");
    cmd.assert().success();

    Ok(())
}

But this leaves me with the deprecation message given. But cargo_bin! isn't deprecated as far as I can see.

I am missing something obvious here but cannot see it.

3 posts - 2 participants

Read full topic

🏷️ Rust_feed