Skip to content
Permalink
Browse files

refactor/misc: remove redundant field names

  • Loading branch information...
povilasb authored and canndrew committed Aug 10, 2018
1 parent 1afcc8f commit 0a441254e382031fbe780da5fd2e3ba2bafb6368
@@ -20,7 +20,7 @@ impl EtherAdaptorV4 {
ether_plug: ether,
ipv4_plug: ipv4,
ipv4_addr: addr,
mac_addr: mac_addr,
mac_addr,
arp_table: HashMap::new(),
arp_pending: HashMap::new(),
};
@@ -168,7 +168,7 @@ impl Future for EtherAdaptorV4 {
fields: ArpFields::Request {
source_mac: self.mac_addr,
source_ip: self.ipv4_addr,
dest_ip: dest_ip,
dest_ip,
},
},
);
@@ -185,7 +185,7 @@ impl Future for EtherAdaptorV4 {
let frame = EtherFrame::new_from_fields(
EtherFields {
source_mac: self.mac_addr,
dest_mac: dest_mac,
dest_mac,
},
&EtherPayload::Ipv4(packet),
);
@@ -7,7 +7,7 @@ pub struct Ipv4Nat {
private_plug: Ipv4Plug,
public_plug: Ipv4Plug,
public_ip: Ipv4Addr,
subnet: Ipv4Range,
subnet: Ipv4Range,
hair_pinning: bool,
udp_map: PortMap,
tcp_map: PortMap,
@@ -167,10 +167,10 @@ impl Ipv4Nat {
subnet: Ipv4Range,
) -> Ipv4Nat {
let ret = Ipv4Nat {
private_plug: private_plug,
public_plug: public_plug,
public_ip: public_ip,
subnet: subnet,
private_plug,
public_plug,
public_ip,
subnet,
hair_pinning: false,
udp_map: PortMap::new(),
tcp_map: PortMap::new(),
@@ -272,17 +272,17 @@ impl Ipv4NatBuilder {

/// Build the NAT
pub fn build(
self,
self,
public_plug: Ipv4Plug,
private_plug: Ipv4Plug,
public_ip: Ipv4Addr,
) -> Ipv4Nat {
let subnet = self.subnet.unwrap_or_else(Ipv4Range::random_local_subnet);
let ret = Ipv4Nat {
private_plug: private_plug,
public_plug: public_plug,
public_ip: public_ip,
subnet: subnet,
private_plug,
public_plug,
public_ip,
subnet,
hair_pinning: self.hair_pinning,
udp_map: self.udp_map,
tcp_map: self.tcp_map,
@@ -760,7 +760,7 @@ fn test_symmetric_map() {
let external_port_0 = asymmetric.map_port(remote_addr_0, internal_addr);
let external_port_1 = asymmetric.map_port(remote_addr_1, internal_addr);
assert_eq!(external_port_0, external_port_1);

let external_port_0 = symmetric.map_port(remote_addr_0, internal_addr);
let external_port_1 = symmetric.map_port(remote_addr_1, internal_addr);
assert!(external_port_0 != external_port_1);
@@ -10,7 +10,7 @@ impl Ipv4RouterBuilder {
/// Start creating a new `Ipv4Router` with the given IP address.
pub fn new(ipv4_addr: Ipv4Addr) -> Ipv4RouterBuilder {
Ipv4RouterBuilder {
ipv4_addr: ipv4_addr,
ipv4_addr,
connections: Vec::new(),
}
}
@@ -18,7 +18,7 @@ impl TapTask {
) -> TapTask {
let (tx, rx) = plug.split();
TapTask {
tap: tap,
tap,
handle: handle.clone(),
frame_tx: tx,
frame_rx: rx,
@@ -18,7 +18,7 @@ impl TunTask {
) -> TunTask {
let (tx, rx) = plug.split();
TunTask {
tun: tun,
tun,
handle: handle.clone(),
packet_tx: tx,
packet_rx: rx,
@@ -16,7 +16,7 @@ impl Network {
let (drop_tx_tx, drop_tx_rx) = std::sync::mpsc::channel();
Network {
handle: handle.clone(),
drop_tx_tx: drop_tx_tx,
drop_tx_tx,
_drop_tx_rx: drop_tx_rx,
}
}
@@ -51,7 +51,7 @@ impl IpLog {
tokio_io::io::write_all(fd, header)
.map(|(fd, _header)| {
IpLog {
fd: fd,
fd,
state: LogState::Ready,
}
})
@@ -87,8 +87,8 @@ impl Sink for IpLog {
unwrap!(cursor.write_u32::<NativeEndian>(bytes.len() as u32));
}
self.state = LogState::WritingHeader {
header: header,
bytes: bytes,
header,
bytes,
written: 0,
};
self.poll_complete()?;
@@ -117,13 +117,13 @@ impl Sink for IpLog {
let new_written = written + n;
if new_written == header.len() {
state = LogState::WritingPayload {
bytes: bytes,
bytes,
written: 0,
};
} else {
state = LogState::WritingHeader {
header: header,
bytes: bytes,
header,
bytes,
written: new_written,
};
}
@@ -145,7 +145,7 @@ impl Sink for IpLog {
state = LogState::Ready;
} else {
state = LogState::WritingPayload {
bytes: bytes,
bytes,
written: new_written,
};
}
@@ -39,12 +39,12 @@ impl<T: fmt::Debug + 'static> Latency<T> {
) {
let latency = Latency {
handle: handle.event_loop().clone(),
plug_a: plug_a,
plug_b: plug_b,
plug_a,
plug_b,
outgoing_a: FuturesUnordered::new(),
outgoing_b: FuturesUnordered::new(),
min_latency: min_latency,
mean_additional_latency: mean_additional_latency,
min_latency,
mean_additional_latency,
};
handle.spawn(latency);
}
@@ -25,7 +25,7 @@ impl Ipv4Range {
let mask = !((!0u32).checked_shr(u32::from(bits)).unwrap_or(0));
Ipv4Range {
addr: Ipv4Addr::from(u32::from(addr) & mask),
bits: bits,
bits,
}
}

@@ -24,7 +24,7 @@ impl Ipv6Range {
let mask = !((!0u128).checked_shr(u32::from(bits)).unwrap_or(0));
Ipv6Range {
addr: Ipv6Addr::from(u128::from(addr) & mask),
bits: bits,
bits,
}
}

@@ -30,7 +30,7 @@ pub fn from_parts<R>(
process_handle: ProcessHandle,
) -> SpawnComplete<R> {
SpawnComplete {
ret_rx: ret_rx,
ret_rx,
process_handle: Some(process_handle),
}
}
@@ -39,7 +39,7 @@ pub fn from_receiver<R>(
ret_rx: oneshot::Receiver<thread::Result<R>>,
) -> SpawnComplete<R> {
SpawnComplete {
ret_rx: ret_rx,
ret_rx,
process_handle: None,
}
}

0 comments on commit 0a44125

Please sign in to comment.
You can’t perform that action at this time.