Skip to content

Commit 2b2b4bf

Browse files
committed
chore(cleanup): silence test-only warnings (unused fixtures + stray attrs)
Three small leftovers from prior cleanups: - **`utils/purl.rs`**: stray `#[cfg(feature = "maven")] #[test]` duplicated immediately above the golang test — leftover from the maven dead-test removal in commit b7c4cca. Deleted. - **`tests/in_process_python_envs.rs`**: helper `git_sha256` + its `sha2` / `Sha256` imports went unused after earlier test fixture refactors. Removed. - **`tests/in_process_remove_repair_lifecycle.rs`**: two `after_hash` test-fixture values that the surrounding mocks no longer reference. Prefixed with `_` so the reader still sees the intended fixture value. - **`tests/apply_network.rs`**: a `let mut args = vec![...]; let _ = args;` leftover from removing the apply-takes-api-flags path. Replaced with just the `argv` build the rest of the function actually uses. Build is now warning-clean under `cargo build --workspace --all-features --tests`. No behavior change. Assisted-by: Claude Code:claude-opus-4-7
1 parent 0c2bcb2 commit 2b2b4bf

4 files changed

Lines changed: 2 additions & 25 deletions

File tree

crates/socket-patch-cli/tests/apply_network.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,8 @@ fn write_manifest_with_patch(socket: &Path, purl: &str, uuid: &str, before_hash:
8181
}
8282

8383
fn run_apply(cwd: &Path, api_url: &str, extra: &[&str]) -> (i32, String, String) {
84-
let mut args = vec![
85-
"apply",
86-
"--json",
87-
"--api-token",
88-
"fake-token-for-test",
89-
"--api-url",
90-
api_url,
91-
"--org",
92-
ORG_SLUG,
93-
];
9484
// CLI rejects --api-token / --api-url / --org on apply (those are
9585
// rollback-only flags) — apply respects them via env vars instead.
96-
// Strip them and pass via env.
97-
let _ = args;
9886
let mut argv: Vec<&str> = vec!["apply", "--json"];
9987
argv.extend_from_slice(extra);
10088
let out = Command::new(binary())

crates/socket-patch-cli/tests/in_process_python_envs.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,12 @@
88
use std::path::Path;
99

1010
use serial_test::serial;
11-
use sha2::{Digest, Sha256};
1211
use socket_patch_cli::commands::scan::{run as scan_run, ScanArgs};
1312
use wiremock::matchers::{method, path};
1413
use wiremock::{Mock, MockServer, ResponseTemplate};
1514

1615
const ORG: &str = "test-org";
1716

18-
fn git_sha256(content: &[u8]) -> String {
19-
let header = format!("blob {}\0", content.len());
20-
let mut hasher = Sha256::new();
21-
hasher.update(header.as_bytes());
22-
hasher.update(content);
23-
hex::encode(hasher.finalize())
24-
}
25-
2617
fn write_dist_info(site_packages: &Path, name: &str, version: &str) {
2718
let canon = name.to_lowercase().replace(['-', '.'], "_");
2819
let dist = site_packages.join(format!("{canon}-{version}.dist-info"));

crates/socket-patch-cli/tests/in_process_remove_repair_lifecycle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ fn make_repair_args(cwd: &Path, mode: &str) -> RepairArgs {
257257
async fn repair_diff_mode_downloads_diff_archives() {
258258
let tmp = tempfile::tempdir().unwrap();
259259
let uuid = "12121212-1212-4121-8121-121212121212";
260-
let after_hash = "abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1";
260+
let _after_hash = "abc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1";
261261

262262
let server = MockServer::start().await;
263263
// Diff mode fetches /v0/orgs/<org>/patches/diff/<uuid> → tar.gz body.
@@ -320,7 +320,7 @@ async fn repair_diff_mode_downloads_diff_archives() {
320320
async fn repair_package_mode_downloads_package_archives() {
321321
let tmp = tempfile::tempdir().unwrap();
322322
let uuid = "13131313-1313-4131-8131-131313131313";
323-
let after_hash = "def456def456def456def456def456def456def456def456def456def456def4";
323+
let _after_hash = "def456def456def456def456def456def456def456def456def456def456def4";
324324

325325
let server = MockServer::start().await;
326326
let archive_bytes = b"fake package archive bytes";

crates/socket-patch-core/src/utils/purl.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,6 @@ mod tests {
322322
assert_eq!(version, "32.1.3-jre");
323323
}
324324

325-
#[cfg(feature = "maven")]
326-
#[test]
327325
#[cfg(feature = "golang")]
328326
#[test]
329327
fn test_parse_golang_purl() {

0 commit comments

Comments
 (0)