Skip to content

Commit fe3bbd7

Browse files
committed
fix: replace deprecated Command::cargo_bin with cargo_bin_cmd! macro
assert_cmd 2.1+ deprecates cargo_bin() as incompatible with custom cargo build-dir, causing CI failure with -D warnings.
1 parent 32f16b6 commit fe3bbd7

File tree

3 files changed

+6
-10
lines changed

3 files changed

+6
-10
lines changed

crates/pgls_cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ mimalloc = "0.1.43"
5252
tikv-jemallocator = "0.6.0"
5353

5454
[dev-dependencies]
55-
assert_cmd = "2.0.16"
55+
assert_cmd = "2.1.2"
5656
insta = { workspace = true, features = ["yaml"] }
5757
pgls_test_utils = { workspace = true }
5858
sqlx = { workspace = true }

crates/pgls_cli/tests/assert_check.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use assert_cmd::Command;
1+
use assert_cmd::cargo_bin_cmd;
22
use insta::assert_snapshot;
33
use std::path::Path;
44
use std::process::ExitStatus;
5-
6-
const BIN: &str = "postgres-language-server";
75
const CONFIG_PATH: &str = "tests/fixtures/postgres-language-server.jsonc";
86

97
#[test]
@@ -134,7 +132,7 @@ fn run_check(args: &[&str]) -> String {
134132
}
135133

136134
fn run_check_with(args: &[&str], stdin: Option<&str>, cwd: Option<&Path>) -> String {
137-
let mut cmd = Command::cargo_bin(BIN).expect("binary not built");
135+
let mut cmd = cargo_bin_cmd!("postgres-language-server");
138136
if let Some(dir) = cwd {
139137
cmd.current_dir(dir);
140138
}

crates/pgls_cli/tests/assert_dblint.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
use assert_cmd::Command;
1+
use assert_cmd::cargo_bin_cmd;
22
use insta::assert_snapshot;
33
use sqlx::PgPool;
44
use std::process::ExitStatus;
55

6-
const BIN: &str = "postgres-language-server";
7-
86
/// Get database URL from the pool's connect options
97
/// Uses the known docker-compose credentials (postgres:postgres)
108
fn get_database_url(pool: &PgPool) -> String {
@@ -84,7 +82,7 @@ async fn dblint_error_on_warnings_detects_issues_snapshot(test_db: PgPool) {
8482
)]
8583
fn dblint_no_database_snapshot() {
8684
// Test that dblint completes gracefully when no database is configured
87-
let mut cmd = Command::cargo_bin(BIN).expect("binary not built");
85+
let mut cmd = cargo_bin_cmd!("postgres-language-server");
8886
let output = cmd
8987
.args(["dblint", "--disable-db", "--log-level", "none"])
9088
.output()
@@ -99,7 +97,7 @@ fn dblint_no_database_snapshot() {
9997
}
10098

10199
fn run_dblint(url: &str, args: &[&str]) -> String {
102-
let mut cmd = Command::cargo_bin(BIN).expect("binary not built");
100+
let mut cmd = cargo_bin_cmd!("postgres-language-server");
103101
let mut full_args = vec!["dblint", "--connection-string", url, "--log-level", "none"];
104102
full_args.extend_from_slice(args);
105103

0 commit comments

Comments
 (0)