Skip to content

Commit

Permalink
cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
blackbeam committed Oct 3, 2020
1 parent 1286223 commit cd30149
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 5 additions & 4 deletions src/conn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,11 @@ impl Conn {
}

fn read_packet(&mut self) -> Result<Vec<u8>> {
let data = self.stream_mut().next().transpose()?.ok_or_else(|| io::Error::new(
io::ErrorKind::BrokenPipe,
"server disconnected",
))?;
let data = self
.stream_mut()
.next()
.transpose()?
.ok_or_else(|| io::Error::new(io::ErrorKind::BrokenPipe, "server disconnected"))?;
match data[0] {
0xff => {
let error_packet = parse_err_packet(&*data, self.0.capability_flags)?;
Expand Down
8 changes: 5 additions & 3 deletions src/conn/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,11 @@ impl OptsBuilder {
///
/// **Note:** IPv6 addresses must be given in square brackets, e.g. `[::1]`.
pub fn ip_or_hostname<T: Into<String>>(mut self, ip_or_hostname: Option<T>) -> Self {
let new = ip_or_hostname.map(Into::into).unwrap_or_else(|| "127.0.0.1".into());
self.opts.0.ip_or_hostname = url::Host::parse(&new)
.unwrap_or_else(|_| url::Host::Domain(new.to_owned()));
let new = ip_or_hostname
.map(Into::into)
.unwrap_or_else(|| "127.0.0.1".into());
self.opts.0.ip_or_hostname =
url::Host::parse(&new).unwrap_or_else(|_| url::Host::Domain(new.to_owned()));
self
}

Expand Down

0 comments on commit cd30149

Please sign in to comment.