Skip to content

Commit 36ddb73

Browse files
sypharGuillaumeGomez
authored andcommitted
fix new clippy errors
1 parent 6c91a0e commit 36ddb73

File tree

3 files changed

+16
-17
lines changed

3 files changed

+16
-17
lines changed

src/storage/compression.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ mod tests {
9090

9191
let data = compress(orig.as_bytes(), alg).unwrap();
9292
assert_eq!(
93-
decompress(data.as_slice(), alg, std::usize::MAX).unwrap(),
93+
decompress(data.as_slice(), alg, usize::MAX).unwrap(),
9494
orig.as_bytes()
9595
);
9696
}

src/storage/database.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ impl DatabaseBackend {
6666
) -> Result<Blob> {
6767
// The maximum size for a BYTEA (the type used for `content`) is 1GB, so this cast is safe:
6868
// https://www.postgresql.org/message-id/162867790712200946i7ba8eb92v908ac595c0c35aee%40mail.gmail.com
69-
let max_size = max_size.min(std::i32::MAX as usize) as i32;
69+
let max_size = max_size.min(i32::MAX as usize) as i32;
7070

7171
struct Result {
7272
path: String,

src/storage/mod.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ impl AsyncStorage {
317317
.join(format!("{archive_path}.{latest_build_id}.index"));
318318

319319
if !local_index_path.exists() {
320-
let index_content = self.get(&remote_index_path, std::usize::MAX).await?.content;
320+
let index_content = self.get(&remote_index_path, usize::MAX).await?.content;
321321

322322
tokio::fs::create_dir_all(
323323
local_index_path
@@ -934,7 +934,7 @@ mod backend_tests {
934934

935935
storage.store_blobs(vec![blob.clone()])?;
936936

937-
let found = storage.get(path, std::usize::MAX)?;
937+
let found = storage.get(path, usize::MAX)?;
938938
assert_eq!(blob.mime, found.mime);
939939
assert_eq!(blob.content, found.content);
940940

@@ -943,7 +943,7 @@ mod backend_tests {
943943

944944
for path in &["bar.txt", "baz.txt", "foo/baz.txt"] {
945945
assert!(storage
946-
.get(path, std::usize::MAX)
946+
.get(path, usize::MAX)
947947
.unwrap_err()
948948
.downcast_ref::<PathNotFoundError>()
949949
.is_some());
@@ -972,19 +972,19 @@ mod backend_tests {
972972
assert_eq!(
973973
blob.content[0..=4],
974974
storage
975-
.get_range("foo/bar.txt", std::usize::MAX, 0..=4, None)?
975+
.get_range("foo/bar.txt", usize::MAX, 0..=4, None)?
976976
.content
977977
);
978978
assert_eq!(
979979
blob.content[5..=12],
980980
storage
981-
.get_range("foo/bar.txt", std::usize::MAX, 5..=12, None)?
981+
.get_range("foo/bar.txt", usize::MAX, 5..=12, None)?
982982
.content
983983
);
984984

985985
for path in &["bar.txt", "baz.txt", "foo/baz.txt"] {
986986
assert!(storage
987-
.get_range(path, std::usize::MAX, 0..=4, None)
987+
.get_range(path, usize::MAX, 0..=4, None)
988988
.unwrap_err()
989989
.downcast_ref::<PathNotFoundError>()
990990
.is_some());
@@ -1094,7 +1094,7 @@ mod backend_tests {
10941094
storage.store_blobs(blobs.clone()).unwrap();
10951095

10961096
for blob in &blobs {
1097-
let actual = storage.get(&blob.path, std::usize::MAX)?;
1097+
let actual = storage.get(&blob.path, usize::MAX)?;
10981098
assert_eq!(blob.path, actual.path);
10991099
assert_eq!(blob.mime, actual.mime);
11001100
}
@@ -1163,13 +1163,12 @@ mod backend_tests {
11631163
assert!(local_index_location.exists());
11641164
assert!(storage.exists_in_archive("folder/test.zip", 0, "src/main.rs",)?);
11651165

1166-
let file = storage.get_from_archive("folder/test.zip", 0, "Cargo.toml", std::usize::MAX)?;
1166+
let file = storage.get_from_archive("folder/test.zip", 0, "Cargo.toml", usize::MAX)?;
11671167
assert_eq!(file.content, b"data");
11681168
assert_eq!(file.mime, "text/toml");
11691169
assert_eq!(file.path, "folder/test.zip/Cargo.toml");
11701170

1171-
let file =
1172-
storage.get_from_archive("folder/test.zip", 0, "src/main.rs", std::usize::MAX)?;
1171+
let file = storage.get_from_archive("folder/test.zip", 0, "src/main.rs", usize::MAX)?;
11731172
assert_eq!(file.content, b"data");
11741173
assert_eq!(file.mime, "text/rust");
11751174
assert_eq!(file.path, "folder/test.zip/src/main.rs");
@@ -1207,12 +1206,12 @@ mod backend_tests {
12071206
"text/rust"
12081207
);
12091208

1210-
let file = storage.get("prefix/Cargo.toml", std::usize::MAX)?;
1209+
let file = storage.get("prefix/Cargo.toml", usize::MAX)?;
12111210
assert_eq!(file.content, b"data");
12121211
assert_eq!(file.mime, "text/toml");
12131212
assert_eq!(file.path, "prefix/Cargo.toml");
12141213

1215-
let file = storage.get("prefix/src/main.rs", std::usize::MAX)?;
1214+
let file = storage.get("prefix/src/main.rs", usize::MAX)?;
12161215
assert_eq!(file.content, b"data");
12171216
assert_eq!(file.mime, "text/rust");
12181217
assert_eq!(file.path, "prefix/src/main.rs");
@@ -1244,7 +1243,7 @@ mod backend_tests {
12441243
storage.store_blobs(uploads.clone())?;
12451244

12461245
for blob in &uploads {
1247-
let stored = storage.get(&blob.path, std::usize::MAX)?;
1246+
let stored = storage.get(&blob.path, usize::MAX)?;
12481247
assert_eq!(&stored.content, &blob.content);
12491248
}
12501249

@@ -1306,11 +1305,11 @@ mod backend_tests {
13061305
storage.delete_prefix(prefix)?;
13071306

13081307
for existing in present {
1309-
assert!(storage.get(existing, std::usize::MAX).is_ok());
1308+
assert!(storage.get(existing, usize::MAX).is_ok());
13101309
}
13111310
for missing in missing {
13121311
assert!(storage
1313-
.get(missing, std::usize::MAX)
1312+
.get(missing, usize::MAX)
13141313
.unwrap_err()
13151314
.downcast_ref::<PathNotFoundError>()
13161315
.is_some());

0 commit comments

Comments
 (0)