Skip to content

Commit

Permalink
Merge pull request #130 from ANSSI-FR/fix-lints
Browse files Browse the repository at this point in the history
Fix lints
  • Loading branch information
commial committed Aug 19, 2022
2 parents a58dd92 + e4d4525 commit 78cea04
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Expand Up @@ -174,4 +174,4 @@ jobs:
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
args: --all-targets -- -D warnings
4 changes: 2 additions & 2 deletions curve25519-parser/src/lib.rs
Expand Up @@ -422,14 +422,14 @@ mod tests {

let pub_pem_key = keypair.public_as_pem();
assert_eq!(
parse_openssl_25519_pubkey(&pub_pem_key.as_bytes())
parse_openssl_25519_pubkey(pub_pem_key.as_bytes())
.unwrap()
.as_bytes(),
pub_key.as_bytes()
);
let priv_pem_key = keypair.private_as_pem();
assert_eq!(
&parse_openssl_25519_privkey(&priv_pem_key.as_bytes())
&parse_openssl_25519_privkey(priv_pem_key.as_bytes())
.unwrap()
.to_bytes(),
&priv_key.to_bytes()
Expand Down
4 changes: 2 additions & 2 deletions mla/benches/bench_archive.rs
Expand Up @@ -47,7 +47,7 @@ pub fn multiple_layers_multiple_block_size(c: &mut Criterion) {

let data: Vec<u8> = Alphanumeric
.sample_iter(&mut rng)
.take(size.clone())
.take(*size)
.map(|c| c as u8)
.collect();

Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn multiple_compression_quality(c: &mut Criterion) {

let data: Vec<u8> = Alphanumeric
.sample_iter(&mut rng)
.take(size.clone())
.take(size)
.map(|c| c as u8)
.collect();

Expand Down
9 changes: 4 additions & 5 deletions mla/src/lib.rs
Expand Up @@ -835,7 +835,7 @@ impl<'a, T: Read + Seek> Read for BlocksToFileReader<'a, T> {
}

#[derive(Serialize, Deserialize)]
#[cfg_attr(test, derive(PartialEq, Debug))]
#[cfg_attr(test, derive(PartialEq, Eq, Debug))]
pub struct FileInfo {
/// File information to save in the footer
///
Expand Down Expand Up @@ -1235,7 +1235,6 @@ impl<'b, R: 'b + Read> ArchiveFailSafeReader<'b, R> {
pub(crate) mod tests {
use super::*;
use curve25519_parser::{parse_openssl_25519_privkey, parse_openssl_25519_pubkey};
use hex;
use rand::distributions::{Distribution, Standard};
use rand::{RngCore, SeedableRng};
use rand_chacha::ChaChaRng;
Expand Down Expand Up @@ -1938,7 +1937,7 @@ pub(crate) mod tests {
.rev()
.map(|i| {
let id = name2id.get(&fnames[i]).unwrap();
mla.append_file_content(id.clone(), 32, &files.get(&fnames[i]).unwrap()[..32])
mla.append_file_content(*id, 32, &files.get(&fnames[i]).unwrap()[..32])
.unwrap();
})
.for_each(drop);
Expand All @@ -1948,7 +1947,7 @@ pub(crate) mod tests {
.map(|i| {
let id = name2id.get(&fnames[i]).unwrap();
let data = &files.get(&fnames[i]).unwrap()[32..];
mla.append_file_content(id.clone(), data.len() as u64, data)
mla.append_file_content(*id, data.len() as u64, data)
.unwrap();
})
.for_each(drop);
Expand All @@ -1958,7 +1957,7 @@ pub(crate) mod tests {
.rev()
.map(|i| {
let id = name2id.get(&fnames[i]).unwrap();
mla.end_file(id.clone()).unwrap();
mla.end_file(*id).unwrap();
})
.for_each(drop);

Expand Down
4 changes: 2 additions & 2 deletions mla/tests/aes_gcm_navs_test_vector.rs
Expand Up @@ -3027,9 +3027,9 @@ fn test_nist_cavs_vectors() {
for tv in TEST_VECTORS {
// Full (all at once)
let mut key = Key::default();
key.copy_from_slice(&tv.key);
key.copy_from_slice(tv.key);
let mut nonce = Nonce::default();
nonce.copy_from_slice(&tv.nonce);
nonce.copy_from_slice(tv.nonce);
let mut cipher = AesGcm256::new(&key, &nonce, tv.aad).unwrap();
let mut buffer = tv.plaintext.to_vec();
cipher.encrypt(&mut buffer);
Expand Down
13 changes: 6 additions & 7 deletions mlar/tests/integration.rs
@@ -1,6 +1,5 @@
use assert_cmd::Command;
use assert_fs::fixture::{FileWriteBin, NamedTempFile, TempDir};
use glob;
use permutate::Permutator;
use rand::distributions::{Alphanumeric, Distribution, Standard};
use rand::rngs::StdRng;
Expand Down Expand Up @@ -298,7 +297,7 @@ fn test_create_list_tar() {
assert.success();

// Inspect the created TAR file
ensure_tar_content(&tar_file.path(), &testfs.files);
ensure_tar_content(tar_file.path(), &testfs.files);
}

#[test]
Expand Down Expand Up @@ -560,8 +559,8 @@ fn test_multiple_compression_level() {
let assert = cmd.assert();
assert.success();
}
ensure_tar_content(&tar_file_q0.path(), &testfs.files);
ensure_tar_content(&tar_file_q5.path(), &testfs.files);
ensure_tar_content(tar_file_q0.path(), &testfs.files);
ensure_tar_content(tar_file_q5.path(), &testfs.files);
}

#[test]
Expand Down Expand Up @@ -635,7 +634,7 @@ fn test_convert() {
assert.success();

// Inspect the created TAR file
ensure_tar_content(&tar_file.path(), &testfs.files);
ensure_tar_content(tar_file.path(), &testfs.files);
}

#[test]
Expand Down Expand Up @@ -687,7 +686,7 @@ fn test_stdio() {
assert.success();

// Inspect the created TAR file
ensure_tar_content(&tar_file.path(), &testfs.files);
ensure_tar_content(tar_file.path(), &testfs.files);
}

#[test]
Expand Down Expand Up @@ -748,7 +747,7 @@ fn test_multi_fileorders() {
assert.success();

// Inspect the created TAR file
ensure_tar_content(&tar_file.path(), &testfs.files);
ensure_tar_content(tar_file.path(), &testfs.files);
}
}

Expand Down

0 comments on commit 78cea04

Please sign in to comment.