Use s.parse(), not u16::from_str_radix(s,10)

Clippy started warning on this with Rust 1.52.  I'm fairly sure that
when I wrote this code I was worried that <u16 as FromStr>::parse()
might allow hex or something.  But fortunately, it doesn't work that
way, so I don't need to be paranoid here.
This commit is contained in:
Nick Mathewson 2021-05-07 15:51:13 -04:00
parent c1f7d49ded
commit d223c232d0
1 changed files with 1 additions and 1 deletions

View File

@ -260,7 +260,7 @@ impl Body for Begin {
let port = std::str::from_utf8(port)
.map_err(|_| Error::BadMessage("port in begin cell not utf8"))?;
let port = u16::from_str_radix(port, 10)
let port = port.parse()
.map_err(|_| Error::BadMessage("port in begin cell not a valid port"))?;
Ok(Begin {