Fix new "useless_vec" warning from clippy +nightly
Explanation at https://rust-lang.github.io/rust-clippy/master/index.html#/useless_vec This is the non-tests subset of the same-named commmit in !1388, (recreated by hand by me, and then checked against that commit; I stole the commit message from Nick's.) This should be uncontroversial I think.
This commit is contained in:
parent
2db3e73434
commit
501454370f
|
@ -280,7 +280,7 @@ impl std::str::FromStr for RelayId {
|
|||
let bytes = hex::decode(s).map_err(|_| RelayIdError::BadHex)?;
|
||||
RelayId::from_type_and_bytes(RelayIdType::Rsa, &bytes)
|
||||
} else {
|
||||
let mut v = vec![0_u8; ED25519_ID_LEN];
|
||||
let mut v = [0_u8; ED25519_ID_LEN];
|
||||
let bytes = Base64Unpadded::decode(s, &mut v[..])?;
|
||||
RelayId::from_type_and_bytes(RelayIdType::Ed25519, bytes)
|
||||
}
|
||||
|
|
|
@ -455,7 +455,7 @@ mod test {
|
|||
|
||||
runtime.block_on(async {
|
||||
let task1 = async {
|
||||
let mut buf = vec![0_u8; 16];
|
||||
let mut buf = [0_u8; 16];
|
||||
let (len, addr) = socket1.recv(&mut buf[..]).await?;
|
||||
IoResult::Ok((buf[..len].to_vec(), addr))
|
||||
};
|
||||
|
@ -491,7 +491,7 @@ mod test {
|
|||
let mut n = 0_u32;
|
||||
loop {
|
||||
let (mut con, _addr) = stream.next().await.unwrap()?;
|
||||
let mut buf = vec![0_u8; 11];
|
||||
let mut buf = [0_u8; 11];
|
||||
con.read_exact(&mut buf[..]).await?;
|
||||
n += 1;
|
||||
if &buf[..] == b"world done!" {
|
||||
|
|
Loading…
Reference in New Issue