rust: fix single_match

warning: you seem to be trying to use `match` for destructuring a single pattern. Consider using `if let`
   --> src/http2/parser.rs:882:17
    |
882 | /                 match ctx.value {
883 | |                     Some(_) => {
884 | |                         panic!("Unexpected value");
885 | |                     }
886 | |                     None => {}
887 | |                 }
    | |_________________^
pull/10167/head
Philippe Antoine 2 years ago committed by Victor Julien
parent 9a84681bd9
commit b141eb9f11

@ -879,12 +879,7 @@ mod tests {
match r {
Ok((rem, ctx)) => {
assert_eq!(ctx.id, HTTP2SettingsId::EnablePush);
match ctx.value {
Some(_) => {
panic!("Unexpected value");
}
None => {}
}
assert!(ctx.value.is_none());
assert_eq!(rem.len(), 0);
}
Err(e) => {

@ -552,11 +552,8 @@ mod tests {
,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00 ,0x00];
let mut hassh_string: Vec<u8> = vec!();
let mut hassh: Vec<u8> = vec!();
match ssh_parse_key_exchange(&client_key_exchange){
Ok((_, key_exchange)) => {
key_exchange.generate_hassh(&mut hassh_string, &mut hassh, &true);
}
Err(_) => { }
if let Ok((_, key_exchange)) = ssh_parse_key_exchange(&client_key_exchange){
key_exchange.generate_hassh(&mut hassh_string, &mut hassh, &true);
}
assert_eq!(hassh_string, "curve25519-sha256,curve25519-sha256@libssh.org,\
@ -643,11 +640,8 @@ mod tests {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
let mut hassh_server_string: Vec<u8> = vec!();
let mut hassh_server: Vec<u8> = vec!();
match ssh_parse_key_exchange(&server_key_exchange){
Ok((_, key_exchange)) => {
key_exchange.generate_hassh(&mut hassh_server_string, &mut hassh_server, &true);
}
Err(_) => { }
if let Ok((_, key_exchange)) = ssh_parse_key_exchange(&server_key_exchange){
key_exchange.generate_hassh(&mut hassh_server_string, &mut hassh_server, &true);
}
assert_eq!(hassh_server, "b12d2871a1189eff20364cf5333619ee".as_bytes().to_vec());
}

Loading…
Cancel
Save