From 3ffbcc6c8a9bca119248d4ffe00c24a903979e1a Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sat, 19 Aug 2023 17:16:31 +0200 Subject: refactor(tvix/store): cargo clippy Change-Id: I3a80560d036e7ed08036b5e9f0974080d1a30ded Reviewed-on: https://cl.tvl.fyi/c/depot/+/9096 Tested-by: BuildkiteCI Reviewed-by: raitobezarius Autosubmit: flokli --- tvix/store/src/blobservice/grpc.rs | 2 +- tvix/store/src/blobservice/tests.rs | 20 ++++++-------------- 2 files changed, 7 insertions(+), 15 deletions(-) (limited to 'tvix/store/src/blobservice') diff --git a/tvix/store/src/blobservice/grpc.rs b/tvix/store/src/blobservice/grpc.rs index a2ca16e6b3a6..71cde35cb21b 100644 --- a/tvix/store/src/blobservice/grpc.rs +++ b/tvix/store/src/blobservice/grpc.rs @@ -169,7 +169,7 @@ impl BlobService for GRPCBlobService { // bytes arriving on the RX side are wrapped inside a // [proto::BlobChunk], and a [ReceiverStream] is constructed. - let blobchunk_stream = ReceiverStream::new(rx).map(|x| proto::BlobChunk { data: x.into() }); + let blobchunk_stream = ReceiverStream::new(rx).map(|x| proto::BlobChunk { data: x }); // That receiver stream is used as a stream in the gRPC BlobService.put rpc call. let task: tokio::task::JoinHandle> = self diff --git a/tvix/store/src/blobservice/tests.rs b/tvix/store/src/blobservice/tests.rs index cc43ce5b180a..ec7a618fab58 100644 --- a/tvix/store/src/blobservice/tests.rs +++ b/tvix/store/src/blobservice/tests.rs @@ -24,12 +24,9 @@ fn gen_sled_blob_service() -> impl BlobService { #[test_case(gen_memory_blob_service(); "memory")] #[test_case(gen_sled_blob_service(); "sled")] fn has_nonexistent_false(blob_service: impl BlobService) { - assert_eq!( - blob_service - .has(&fixtures::BLOB_A_DIGEST) - .expect("must not fail"), - false - ); + assert!(!blob_service + .has(&fixtures::BLOB_A_DIGEST) + .expect("must not fail")); } /// Trying to read a non-existing blob should return a None instead of a reader. @@ -62,9 +59,8 @@ fn put_has_get(blob_service: impl BlobService, blob_contents: &[u8], blob_digest assert_eq!(*blob_digest, digest, "returned digest must be correct"); - assert_eq!( + assert!( blob_service.has(blob_digest).expect("must not fail"), - true, "blob service should now have the blob" ); @@ -116,9 +112,7 @@ fn put_seek(blob_service: impl BlobService) { pos += buf.len() as u64; } // seek by 0 bytes, using SeekFrom::Start. - let p = r - .seek(io::SeekFrom::Start(pos as u64)) - .expect("must not fail"); + let p = r.seek(io::SeekFrom::Start(pos)).expect("must not fail"); assert_eq!(pos, p); // read the next 10 bytes, they must match the data in the fixture. @@ -136,9 +130,7 @@ fn put_seek(blob_service: impl BlobService) { } // seek by 5 bytes, using SeekFrom::Start. - let p = r - .seek(io::SeekFrom::Start(pos as u64 + 5)) - .expect("must not fail"); + let p = r.seek(io::SeekFrom::Start(pos + 5)).expect("must not fail"); pos += 5; assert_eq!(pos, p); -- cgit 1.4.1