Skip to content

Commit 2c20ef5

Browse files
committed
deploy: Fix disallowed str::len in user-agent test
The repo disallows `str::len` (clippy::disallowed-methods) to avoid confusing byte length with character count. Rework the assertion to use `strip_prefix`, which both checks the prefix and gives us the remainder to assert is non-empty. Assisted-by: opencode (Claude Opus 4.8) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent 4bdc651 commit 2c20ef5

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

crates/lib/src/deploy.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,13 +1402,12 @@ mod tests {
14021402
let prefix = config
14031403
.user_agent_prefix
14041404
.expect("user_agent_prefix should be set");
1405-
assert!(
1406-
prefix.starts_with("bootc/"),
1407-
"User agent should start with bootc/"
1408-
);
14091405
// Verify the version is present (not just "bootc/")
1406+
let version = prefix
1407+
.strip_prefix("bootc/")
1408+
.expect("User agent should start with bootc/");
14101409
assert!(
1411-
prefix.len() > "bootc/".len(),
1410+
!version.is_empty(),
14121411
"Version should be present after bootc/"
14131412
);
14141413
}

0 commit comments

Comments
 (0)