Using copy trait more often

This commit is contained in:
Dennis Schwerdel 2016-01-19 21:52:44 +01:00
parent b6449484e5
commit 4b68923f75
3 changed files with 5 additions and 5 deletions

View File

@ -75,7 +75,7 @@ impl Table for SwitchTable {
#[inline]
fn learn(&mut self, key: Address, _prefix_len: Option<u8>, addr: SocketAddr) {
let value = SwitchTableValue{address: addr, timeout: now()+self.timeout as Time};
if self.table.insert(key.clone(), value).is_none() {
if self.table.insert(key, value).is_none() {
info!("Learned address {} => {}", key, addr);
}
}

View File

@ -11,7 +11,7 @@ pub type NetworkId = u64;
pub type NodeId = [u8; NODE_ID_BYTES];
#[derive(PartialOrd, Eq, Ord, Clone, Hash)]
#[derive(PartialOrd, Eq, Ord, Clone, Hash, Copy)]
pub struct Address {
pub data: [u8; 16],
pub len: u8
@ -128,7 +128,7 @@ impl FromStr for Address {
}
#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone)]
#[derive(PartialEq, PartialOrd, Eq, Ord, Hash, Clone, Copy)]
pub struct Range {
pub base: Address,
pub prefix_len: u8
@ -196,7 +196,7 @@ impl fmt::Display for Type {
}
#[derive(RustcDecodable, Debug)]
#[derive(RustcDecodable, Debug, Clone, Copy)]
pub enum Mode {
Normal, Hub, Switch, Router
}

View File

@ -10,7 +10,7 @@ pub const VERSION: u8 = 1;
const NETWORK_ID_BYTES: usize = 8;
#[derive(Clone)]
#[derive(Clone, Copy)]
#[repr(packed)]
struct TopHeader {
magic: [u8; 3],