title: How to handle error: nested generic parameters is never used
body: <p>Trying to use T as generic parameter of a trait of another generic parameter <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=04c32b88e0286d54a664c9c5b428dddc" rel="nofollow noreferrer">this way</a>:</p>
  <pre class="lang-rust prettyprint-override"><code>pub trait Foo&lt;T&gt; {
      fn foo() -&gt; T;
  }
  
  struct Bar&lt;T, F: Foo&lt;T&gt;&gt; {
      f: F,
  }
  
  fn main() {
  }
  </code></pre>
  <p>Failing with:</p>
  <pre><code>error[E0392]: parameter `T` is never used
   --&gt; src/main.rs:5:12
    |
  5 | struct Bar&lt;T, F: Foo&lt;T&gt;&gt; {
    |            ^ unused parameter
    |
    = help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
  </code></pre>
  <p>The compiler advice is to use <a href="https://play.rust-lang.org/?version=stable&amp;mode=debug&amp;edition=2018&amp;gist=5529716e2421c45777923c3322189124" rel="nofollow noreferrer"><code>PhantomData</code></a>:</p>
  <pre class="lang-rust prettyprint-override"><code>use core::marker::PhantomData;
  
  pub trait Foo&lt;T&gt; {
      fn foo() -&gt; T;
  }
  
  struct Bar&lt;T, F: Foo&lt;T&gt;&gt; {
      f: F,
      t: PhantomData&lt;T&gt;,
  }
  
  fn main() {
  }
  </code></pre>
  <p>Isn't there a more elegant way to deal with this than creating a fake field with a strangely named traits?</p>