title: Is the compiler smart enough to infer a parsed value's type based on the value's usage in a function which expects that type?
body: <p>I found this code on <a href="https://tokio.rs/docs/getting-started/hello-world/" rel="nofollow noreferrer">the tokio hello world page</a>:</p>
  
  <pre><code>fn main() {
      let addr = "127.0.0.1:6142".parse().unwrap();
      let listener = TcpListener::bind(&amp;addr).unwrap();
  
      // Following snippets come here...
  }
  </code></pre>
  
  <p>Is the Rust compiler actually smart enough to infer that the type that the string holding the IP address should be parsed to is <code>std::net::SocketAddr</code> because the parsed variable is passed to the bind method which expects that type? Why don't you need to <a href="https://stackoverflow.com/questions/27043268/convert-a-string-to-int-in-rust">use the turbofish operator (::&lt;>) or an explicit type annotation</a>?</p>