Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dns: fix clippy lint warnings (keep comments) #12284

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 19 additions & 21 deletions rust/src/dns/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1089,11 +1089,10 @@ mod tests {
fn test_dns_parse_name_truncated() {
// Generate a non-compressed hostname over our maximum of 1024.
let mut buf: Vec<u8> = vec![];
for _ in 0..17 {

for i in 1..18 {
buf.push(0b0011_1111);
for _ in 0..63 {
buf.push(b'a');
}
buf.resize(i * 64, b'a');
}

let mut flags = DNSNameFlags::default();
Expand All @@ -1120,20 +1119,21 @@ mod tests {

#[test]
fn test_dns_parse_name_truncated_max_segments_with_pointer() {
let mut buf: Vec<u8> = vec![];

// "a" at the beginning of the buffer.
buf.push(0b0000_0001);
buf.push(b'a');

// Followed by a pointer back to the beginning.
buf.push(0b1100_0000);
buf.push(0b0000_0000);

// The start of the name, which is pointer to the beginning of
// the buffer.
buf.push(0b1100_0000);
buf.push(0b000_0000);
#[rustfmt::skip]
let buf: Vec<u8> = vec![
// "a" at the beginning of the buffer.
0b0000_0001,
b'a',

// Followed by a pointer back to the beginning.
0b1100_0000,
0b0000_0000,

// The start of the name, which is pointer to the beginning of
// the buffer.
0b1100_0000,
0b000_0000
];

let mut flags = DNSNameFlags::default();
let (_rem, name) = dns_parse_name(&buf[4..], &buf, &mut flags).unwrap();
Expand All @@ -1143,9 +1143,7 @@ mod tests {

#[test]
fn test_dns_parse_name_self_reference() {
let mut buf = vec![];
buf.push(0b1100_0000);
buf.push(0b0000_0000);
let buf = vec![0b1100_0000, 0b0000_0000];
let mut flags = DNSNameFlags::default();
assert!(dns_parse_name(&buf, &buf, &mut flags).is_err());
}
Expand Down
Loading