Skip to content

Commit bafd041

Browse files
bartlomiejuclaude
andcommitted
fix: temporary value dropped while borrowed on Windows
Split json.unwrap() into a separate let binding before passing to String::from_utf8_lossy to avoid temporary lifetime issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b4f0f01 commit bafd041

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_api.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12734,7 +12734,8 @@ fn crdtp_create_response() {
1273412734

1273512735
let json = v8::crdtp::cbor_to_json(&bytes);
1273612736
assert!(json.is_some());
12737-
let json_str = String::from_utf8_lossy(&json.unwrap());
12737+
let json_bytes = json.unwrap();
12738+
let json_str = String::from_utf8_lossy(&json_bytes);
1273812739
assert!(json_str.contains("42"));
1273912740
assert!(json_str.contains("result"));
1274012741
}
@@ -12747,7 +12748,8 @@ fn crdtp_create_notification() {
1274712748

1274812749
let json = v8::crdtp::cbor_to_json(&bytes);
1274912750
assert!(json.is_some());
12750-
let json_str = String::from_utf8_lossy(&json.unwrap());
12751+
let json_bytes = json.unwrap();
12752+
let json_str = String::from_utf8_lossy(&json_bytes);
1275112753
assert!(json_str.contains("Test.event"));
1275212754
}
1275312755

@@ -13106,7 +13108,8 @@ fn crdtp_create_error_notification() {
1310613108

1310713109
let json = v8::crdtp::cbor_to_json(&bytes);
1310813110
assert!(json.is_some());
13109-
let json_str = String::from_utf8_lossy(&json.unwrap());
13111+
let json_bytes = json.unwrap();
13112+
let json_str = String::from_utf8_lossy(&json_bytes);
1311013113
assert!(json_str.contains("error"));
1311113114
assert!(json_str.contains("internal failure"));
1311213115
}

0 commit comments

Comments
 (0)