title: expected enum `std::result::Result`, found ()
body: <p>I'm new to Rust.<br>
  I try to create a <code>Point</code> struct that implements <code>Eq</code> and <code>Debug</code>, so I did this:  </p>
  
  <pre class="lang-rust prettyprint-override"><code>use std::fmt;
  
  pub struct Point {
      x: f32,
      y: f32,
  }
  
  impl Point {
      pub fn new(x: f32, y: f32) -&gt; Point {
          Point{
              x: x,
              y: y,
          }
      }
  }
  
  impl fmt::Debug for Point {
      fn fmt(&amp;self, f: &amp;mut fmt::Formatter&lt;'_&gt;) -&gt; fmt::Result {
          write!(f, "({}, {})", self.x, self.y);
      }
  }
  
  impl PartialEq for Point {
      fn eq(&amp;self, other: &amp;Self) -&gt; bool {
          return self.x == other.x &amp;&amp; self.y == other.y;
      }
  }
  
  impl Eq for Point { }
  </code></pre>
  
  <p>Whenever I try to compile the program, I get an error on this line: <code>fn fmt(&amp;self, f: &amp;mut fmt::Formatter&lt;'_&gt;) -&gt; fmt::Result {</code>, saying:  </p>
  
  <pre><code>mismatched types
  
  expected enum `std::result::Result`, found ()
  
  note: expected type `std::result::Result&lt;(), std::fmt::Error&gt;`
           found type `()`rustc(E0308)
  </code></pre>
  
  <p>From what I understand, <code>()</code> is like the <code>void</code> type, and when you wrap it around <code>Result</code> like this: <code>Result&lt;(), Error&gt;</code>, you basically expect the <code>void</code> type but you also catch errors. Is it right? In that case, why do I get a compilation error?</p>