diff --git a/Cargo.toml b/Cargo.toml index 809c603d9..f6fe4503b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "GPL-3.0" name = "self_encryption" readme = "README.md" repository = "https://github.com/maidsafe/self_encryption" -version = "0.30.266" +version = "0.31.0" [features] default = [] diff --git a/src/lib.rs b/src/lib.rs index 88b6a2a67..879f93bb9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -811,7 +811,7 @@ mod data_map_tests { let chunk_size = *MAX_CHUNK_SIZE; let data_size = num_chunks * chunk_size; let data = test_helpers::random_bytes(data_size); - let (data_map, _) = encrypt(Bytes::from(data))?; + let (data_map, _) = encrypt(data)?; Ok(data_map) } @@ -821,7 +821,7 @@ mod data_map_tests { // Create dummy hashes - each hash is just the chunk number repeated let chunk_identifiers = (0..num_chunks) .map(|i| { - let dummy_hash = XorName::from_content(&vec![i as u8; 32]); // Convert to XorName + let dummy_hash = XorName::from_content(&[i as u8; 32]); // Convert to XorName ChunkInfo { index: i, dst_hash: dummy_hash, @@ -1031,7 +1031,7 @@ mod data_map_tests { // Create test data and encrypt it let test_data = test_helpers::random_bytes(1024 * 1024); // 1MB of random data - let (data_map, encrypted_chunks) = encrypt(Bytes::from(test_data.clone()))?; + let (data_map, encrypted_chunks) = encrypt(test_data.clone())?; // Store chunks to disk for chunk in encrypted_chunks { @@ -1069,7 +1069,7 @@ mod data_map_tests { // Create test data and encrypt it let test_data = test_helpers::random_bytes(1024 * 1024); // 1MB of random data - let (data_map, encrypted_chunks) = encrypt(Bytes::from(test_data.clone()))?; + let (data_map, encrypted_chunks) = encrypt(test_data.clone())?; // Store chunks in memory for chunk in encrypted_chunks { @@ -1110,7 +1110,7 @@ mod data_map_tests { // Create test data and encrypt it let test_data = test_helpers::random_bytes(1024 * 1024); - let (data_map, encrypted_chunks) = encrypt(Bytes::from(test_data))?; + let (data_map, encrypted_chunks) = encrypt(test_data)?; // Store only half of the chunks for (i, chunk) in encrypted_chunks.into_iter().enumerate() { @@ -1149,7 +1149,7 @@ mod data_map_tests { // Create test data and encrypt it let test_data = test_helpers::random_bytes(1024 * 1024); - let (data_map, encrypted_chunks) = encrypt(Bytes::from(test_data))?; + let (data_map, encrypted_chunks) = encrypt(test_data)?; // Store chunks for chunk in encrypted_chunks { @@ -1181,7 +1181,7 @@ mod data_map_tests { // Create test data and encrypt it let test_data = test_helpers::random_bytes(1024 * 1024); - let (data_map, encrypted_chunks) = encrypt(Bytes::from(test_data.clone()))?; + let (data_map, encrypted_chunks) = encrypt(test_data.clone())?; // Store chunks with their original hashes for chunk in encrypted_chunks { diff --git a/src/python.rs b/src/python.rs index 77da15a96..9ff55d299 100644 --- a/src/python.rs +++ b/src/python.rs @@ -154,10 +154,7 @@ fn encrypt_file(file_path: String, output_dir: String) -> PyResult<(PyDataMap, V encrypt_from_file(&PathBuf::from(file_path), &PathBuf::from(output_dir)) .map_err(|e| PyErr::new::(e.to_string()))?; - let chunk_filenames: Vec = chunk_names - .into_iter() - .map(|name| hex::encode(name)) - .collect(); + let chunk_filenames: Vec = chunk_names.into_iter().map(hex::encode).collect(); Ok((PyDataMap { inner: data_map }, chunk_filenames)) } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index f7a318a19..a6e326aef 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -104,7 +104,7 @@ impl StorageBackend { } } - let disk_chunks: Vec<_> = std::fs::read_dir(&self.disk_dir.path())? + let disk_chunks: Vec<_> = std::fs::read_dir(self.disk_dir.path())? .filter_map(|entry| entry.ok()) .collect(); println!("Disk storage contains {} chunks", disk_chunks.len());