dhcp: Rework constructs to use Self/Default

pull/6139/head
Jeff Lucovsky 4 years ago committed by Victor Julien
parent 1ef0bd580b
commit aafb0a60b7

@ -129,6 +129,7 @@ impl Drop for DHCPTransaction {
export_tx_get_detect_state!(rs_dhcp_tx_get_detect_state, DHCPTransaction);
export_tx_set_detect_state!(rs_dhcp_tx_set_detect_state, DHCPTransaction);
#[derive(Default)]
pub struct DHCPState {
// Internal transaction ID.
tx_id: u64,
@ -140,12 +141,8 @@ pub struct DHCPState {
}
impl DHCPState {
pub fn new() -> DHCPState {
return DHCPState {
tx_id: 0,
transactions: Vec::new(),
events: 0,
};
pub fn new() -> Self {
Default::default()
}
pub fn parse(&mut self, input: &[u8]) -> bool {

@ -30,10 +30,10 @@ pub struct DHCPLogger {
impl DHCPLogger {
pub fn new(conf: ConfNode) -> DHCPLogger {
return DHCPLogger{
pub fn new(conf: ConfNode) -> Self {
return Self {
extended: conf.get_child_bool("extended"),
};
}
}
fn get_type(&self, tx: &DHCPTransaction) -> Option<u8> {

Loading…
Cancel
Save