Skip to content

Commit

Permalink
Satisfy clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Nov 12, 2024
1 parent b0c9456 commit 6a41717
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions aws-lc-rs/src/aead/tests/fips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const TEST_NONCE_96_BIT: [u8; 12] = [
0xe4, 0x39, 0x17, 0x95, 0x86, 0xcd, 0xcd, 0x5a, 0x1b, 0x46, 0x7b, 0x1d,
];

const TEST_MESSAGE: &str = "test message";
const TEST_MESSAGE: &[u8] = "test message".as_bytes();

macro_rules! nonce_sequence_api {
($name:ident, $alg:expr, $key:expr, $seal_expect:path, $open_expect:path) => {
Expand Down Expand Up @@ -59,7 +59,7 @@ macro_rules! nonce_sequence_api {
)
.unwrap();

assert_eq!(TEST_MESSAGE.as_bytes(), result);
assert_eq!(TEST_MESSAGE, result);
}

{
Expand Down Expand Up @@ -89,7 +89,7 @@ macro_rules! nonce_sequence_api {
)
.unwrap();

assert_eq!(TEST_MESSAGE.as_bytes(), result);
assert_eq!(TEST_MESSAGE, result);
}
}
};
Expand Down Expand Up @@ -137,7 +137,7 @@ macro_rules! randnonce_api {
)
.unwrap();

assert_eq!(TEST_MESSAGE.as_bytes(), in_out);
assert_eq!(TEST_MESSAGE, in_out);
}

{
Expand All @@ -157,7 +157,7 @@ macro_rules! randnonce_api {
)
.unwrap();

assert_eq!(TEST_MESSAGE.as_bytes(), in_out);
assert_eq!(TEST_MESSAGE, in_out);
}
}
};
Expand Down Expand Up @@ -213,7 +213,7 @@ macro_rules! tls_nonce_api {
)
.unwrap();

assert_eq!(in_out, TEST_MESSAGE.as_bytes());
assert_eq!(in_out, TEST_MESSAGE);
}
};
// Match for unsupported variants
Expand Down
6 changes: 3 additions & 3 deletions aws-lc-rs/src/aead/tests/fips/chacha20_poly1305_openssh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ fn test() {

#[allow(clippy::cast_possible_truncation)]
message.extend_from_slice({
let len = TEST_MESSAGE.as_bytes().len() as u32;
let len = TEST_MESSAGE.len() as u32;
&[
((len & 0xFF00_0000) >> 24) as u8,
((len & 0xFF_0000) >> 16) as u8,
((len & 0xFF00) >> 8) as u8,
(len & 0xFF) as u8,
]
});
message.extend_from_slice(TEST_MESSAGE.as_bytes());
message.extend_from_slice(TEST_MESSAGE);

let mut tag = [0u8; 16];

Expand Down Expand Up @@ -58,5 +58,5 @@ fn test() {
key.open_in_place(1024, &mut message, &tag).unwrap(),
FipsServiceStatus::NonApproved
);
assert_eq!(TEST_MESSAGE.as_bytes(), message);
assert_eq!(TEST_MESSAGE, message);
}
6 changes: 3 additions & 3 deletions aws-lc-rs/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,9 @@ impl TestCase {
let s = self.consume_optional_string(key)?;
let result = if s.starts_with('\"') {
// The value is a quoted UTF-8 string.

let mut bytes = Vec::with_capacity(s.as_bytes().len());
let mut s = s.as_bytes().iter().skip(1);
let s = s.as_bytes();
let mut bytes = Vec::with_capacity(s.len());
let mut s = s.iter().skip(1);
loop {
let b = match s.next() {
Some(b'\\') => {
Expand Down

0 comments on commit 6a41717

Please sign in to comment.