Elektrine lite

← Feed

@blp@framapiaf.org

Post #1366726

2026-04-15 00:28 UTC

@olsonseank I can understand why `struct S` is an error. My question is more about why `fn f()` doesn't cause a warning, since most uses of it will. Even the following: fn f() {} fn g() { f(); } produces a compiler warning saying that `T` can't be inferred, but no warning about the useless `T` parameter. It's occasionally taken me a minute to realize that the correct solution is to remove `T`, not to provide a type for it.

Replies (1)

  • @olsonseank@hachyderm.io 2026-04-15 01:15

    @blp Ah. Such functions have legitimate uses, so perhaps the compiler team didn't feel that this met the bar for warnings. There is a lint for this though! https://rust-lang.github.io/rust-clippy/stable/index.html?search=extra_unused_type_parameters

    Open ##1366727