title: How to make this iterator/for loop idiomatic in Rust
body: <p>How can I get rid of the ugly <code>let mut i = 0;</code> and <code>i += 1;</code>? Is there a more idomatic way I can write this loop? I tried <code>.enumerate()</code> but it doesn't work on a &amp;[&amp;str].</p>
  <pre><code>use std::fmt::Write;
  
  pub fn build_proverb(list: &amp;[&amp;str]) -&gt; String {
      let mut proverb = String::new();
      let mut i = 0;
      for word in list {
          i += 1;
          if i &lt; list.len() {
              write!(proverb, &quot;For want of a {} the {} was lost.\n&quot;, word, list[i]);
          } else {
              write!(proverb, &quot;And all for the want of a {}.&quot;, list[0]);
          }
      }
      proverb
  }
  </code></pre>