simplify expressions

This commit is contained in:
uniminin 2020-11-28 19:27:23 +06:00
parent 5041abde27
commit abd3bb9525
5 changed files with 70 additions and 70 deletions

View File

@ -301,8 +301,8 @@ pub struct DnsQuestion {
impl DnsQuestion {
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
DnsQuestion {
name: name,
qtype: qtype,
name,
qtype,
}
}
@ -353,19 +353,19 @@ impl DnsRecord {
);
Ok(DnsRecord::A {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::UNKNOWN(_) => {
buffer.step(data_len as usize)?;
Ok(DnsRecord::UNKNOWN {
domain: domain,
domain,
qtype: qtype_num,
data_len: data_len,
ttl: ttl,
data_len,
ttl,
})
}
}

View File

@ -337,8 +337,8 @@ pub struct DnsQuestion {
impl DnsQuestion {
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
DnsQuestion {
name: name,
qtype: qtype,
name,
qtype,
}
}
@ -399,19 +399,19 @@ impl DnsRecord {
);
Ok(DnsRecord::A {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::UNKNOWN(_) => {
buffer.step(data_len as usize)?;
Ok(DnsRecord::UNKNOWN {
domain: domain,
domain,
qtype: qtype_num,
data_len: data_len,
ttl: ttl,
data_len,
ttl,
})
}
}

View File

@ -362,8 +362,8 @@ pub struct DnsQuestion {
impl DnsQuestion {
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
DnsQuestion {
name: name,
qtype: qtype,
name,
qtype,
}
}
@ -445,9 +445,9 @@ impl DnsRecord {
);
Ok(DnsRecord::A {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::AAAA => {
@ -467,9 +467,9 @@ impl DnsRecord {
);
Ok(DnsRecord::AAAA {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::NS => {
@ -477,9 +477,9 @@ impl DnsRecord {
buffer.read_qname(&mut ns)?;
Ok(DnsRecord::NS {
domain: domain,
domain,
host: ns,
ttl: ttl,
ttl,
})
}
QueryType::CNAME => {
@ -487,9 +487,9 @@ impl DnsRecord {
buffer.read_qname(&mut cname)?;
Ok(DnsRecord::CNAME {
domain: domain,
domain,
host: cname,
ttl: ttl,
ttl,
})
}
QueryType::MX => {
@ -498,20 +498,20 @@ impl DnsRecord {
buffer.read_qname(&mut mx)?;
Ok(DnsRecord::MX {
domain: domain,
priority: priority,
domain,
priority,
host: mx,
ttl: ttl,
ttl,
})
}
QueryType::UNKNOWN(_) => {
buffer.step(data_len as usize)?;
Ok(DnsRecord::UNKNOWN {
domain: domain,
domain,
qtype: qtype_num,
data_len: data_len,
ttl: ttl,
data_len,
ttl,
})
}
}

View File

@ -362,8 +362,8 @@ pub struct DnsQuestion {
impl DnsQuestion {
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
DnsQuestion {
name: name,
qtype: qtype,
name,
qtype,
}
}
@ -445,9 +445,9 @@ impl DnsRecord {
);
Ok(DnsRecord::A {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::AAAA => {
@ -467,9 +467,9 @@ impl DnsRecord {
);
Ok(DnsRecord::AAAA {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::NS => {
@ -477,9 +477,9 @@ impl DnsRecord {
buffer.read_qname(&mut ns)?;
Ok(DnsRecord::NS {
domain: domain,
domain,
host: ns,
ttl: ttl,
ttl,
})
}
QueryType::CNAME => {
@ -487,9 +487,9 @@ impl DnsRecord {
buffer.read_qname(&mut cname)?;
Ok(DnsRecord::CNAME {
domain: domain,
domain,
host: cname,
ttl: ttl,
ttl,
})
}
QueryType::MX => {
@ -498,20 +498,20 @@ impl DnsRecord {
buffer.read_qname(&mut mx)?;
Ok(DnsRecord::MX {
domain: domain,
priority: priority,
domain,
priority,
host: mx,
ttl: ttl,
ttl,
})
}
QueryType::UNKNOWN(_) => {
buffer.step(data_len as usize)?;
Ok(DnsRecord::UNKNOWN {
domain: domain,
domain,
qtype: qtype_num,
data_len: data_len,
ttl: ttl,
data_len,
ttl,
})
}
}

View File

@ -362,8 +362,8 @@ pub struct DnsQuestion {
impl DnsQuestion {
pub fn new(name: String, qtype: QueryType) -> DnsQuestion {
DnsQuestion {
name: name,
qtype: qtype,
name,
qtype,
}
}
@ -445,9 +445,9 @@ impl DnsRecord {
);
Ok(DnsRecord::A {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::AAAA => {
@ -467,9 +467,9 @@ impl DnsRecord {
);
Ok(DnsRecord::AAAA {
domain: domain,
addr: addr,
ttl: ttl,
domain,
addr,
ttl,
})
}
QueryType::NS => {
@ -477,9 +477,9 @@ impl DnsRecord {
buffer.read_qname(&mut ns)?;
Ok(DnsRecord::NS {
domain: domain,
domain,
host: ns,
ttl: ttl,
ttl,
})
}
QueryType::CNAME => {
@ -487,9 +487,9 @@ impl DnsRecord {
buffer.read_qname(&mut cname)?;
Ok(DnsRecord::CNAME {
domain: domain,
domain,
host: cname,
ttl: ttl,
ttl,
})
}
QueryType::MX => {
@ -498,20 +498,20 @@ impl DnsRecord {
buffer.read_qname(&mut mx)?;
Ok(DnsRecord::MX {
domain: domain,
priority: priority,
domain,
priority,
host: mx,
ttl: ttl,
ttl,
})
}
QueryType::UNKNOWN(_) => {
buffer.step(data_len as usize)?;
Ok(DnsRecord::UNKNOWN {
domain: domain,
domain,
qtype: qtype_num,
data_len: data_len,
ttl: ttl,
data_len,
ttl,
})
}
}