title: Cannot display a SocketAddr returned by peer_addr()
body: <p>I'm trying to print the address returned by peer_addr() of a TcpStream but Rust gives the error:</p>
  
  <blockquote>
    <p>error: the trait <code>core::fmt::Display</code> is not implemented for the type <code>core::result::Result&lt;std::net::addr::SocketAddr, std::io::error::Error&gt;</code> [E0277]
    src/main.rs:29     format!("New client {}", stream.peer_addr());</p>
  </blockquote>
  
  <p>According to the <a href="https://doc.rust-lang.org/std/net/enum.SocketAddr.html" rel="nofollow">documentation</a> Display is implemented.</p>
  
  <p>Code is as follows:</p>
  
  <pre><code>use std::net::{TcpListener, TcpStream};
  use std::thread;
  
  fn main()
  {
      let listener = TcpListener::bind("127.0.0.1:80").unwrap();
  
      for stream in listener.incoming() {
          match stream {
              Ok(stream) =&gt; {
                  thread::spawn(move|| {
                      // connection succeeded
                      handle_client(stream)
                  });
              }
              Err(e) =&gt; {
                  println!("Accept err {}", e);
              }
          }
      }
  
      // close the socket server
      drop(listener);
  }
  
  fn handle_client(stream: TcpStream) {
      println!("New client {}", stream.peer_addr());
  }
  </code></pre>