Replace if / else if using a match

This commit is contained in:
Pierre Lalet 2021-12-16 02:00:40 +01:00
parent 5fb3481607
commit 7427d28d52

View file

@ -118,17 +118,16 @@ pub fn repl<'a>(
} }
} }
/* proto over else (e.g., UDP) */ /* proto over else (e.g., UDP) */
if id == PROTO_HTTP { match id {
return http::repl(data, masscanned, client_info); PROTO_HTTP => http::repl(data, masscanned, client_info),
} else if id == PROTO_STUN { PROTO_STUN => stun::repl(data, masscanned, &mut client_info),
return stun::repl(data, masscanned, &mut client_info); PROTO_SSH => ssh::repl(data, masscanned, &mut client_info),
} else if id == PROTO_SSH { _ => {
return ssh::repl(data, masscanned, &mut client_info);
} else {
debug!("id: {}", id); debug!("id: {}", id);
}
None None
} }
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {