clippy: fix lints in tests

This commit is contained in:
2025-12-21 13:31:51 +01:00
parent f4aa70ca62
commit 2388401e13

View File

@@ -159,7 +159,9 @@ fn test_get_exact_block_size() {
fn test_get_large_file() { fn test_get_large_file() {
let ctx = TestContext::new(false); let ctx = TestContext::new(false);
// Multi-block file: 2.5 blocks // Multi-block file: 2.5 blocks
let content: Vec<u8> = (0..1280).map(|i| (i % 256) as u8).collect(); //#[allow(clippy::cast_sign_loss)]
#[allow(clippy::cast_possible_truncation)]
let content: Vec<u8> = (0u16..1280).map(|i| (i % 256) as u8).collect();
ctx.create_server_file("large.bin", &content); ctx.create_server_file("large.bin", &content);
let client = ctx.client(); let client = ctx.client();
@@ -188,7 +190,7 @@ fn test_get_file_not_found() {
let result = client.get("nonexistent.txt", Mode::Octet); let result = client.get("nonexistent.txt", Mode::Octet);
assert!(result.is_err()); assert!(result.is_err());
let err = result.unwrap_err(); let err = result.expect_err("Expected Not found error, but instead got Ok result");
assert!(err.to_string().contains("not found") || err.to_string().contains("Remote error")); assert!(err.to_string().contains("not found") || err.to_string().contains("Remote error"));
} }
@@ -213,7 +215,8 @@ fn test_put_small_file() {
fn test_put_large_file() { fn test_put_large_file() {
let ctx = TestContext::new(true); let ctx = TestContext::new(true);
// Multi-block file // Multi-block file
let content: Vec<u8> = (0..2000).map(|i| (i % 256) as u8).collect(); #[allow(clippy::cast_possible_truncation)]
let content: Vec<u8> = (0u16..2000).map(|i| (i % 256) as u8).collect();
let client = ctx.client(); let client = ctx.client();
client client