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:
parent
c1f7d49ded
commit
d223c232d0
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue