Linting and match ergonomics

Both of which are scheduled to get uplifted together with drop_ref and drop_copy

Probably not :wink: Most of the defensiveness (at least from me) is a counter-reaction to the swath of "match ergonomics will destroy Rust, we must lint it away" messages that happened just after stabilization. Sorry that the bar has been raised, but I hope you can see why it happened.

This so much. Warn by default in my book. Or we just fix the unused mut lint of rustc to detect this case

I'm wondering whether it would make sense to opt out if it is written as match &mut foo { .. }, since the user is obviously requesting it.

So I'm thinking we should have a further clippy category for defensive programming. According to the clippy 1.0 RFC this needs a further RFC. We can brainstorm it here in the internals forum. I'll fork the discussion from this post.

Thanks for doing this! Although I personally disagree that the examples are problematic (or more my opinion is that code on which such effects would be observable is problematic to begin with), I accept that

  1. these examples are minified and contrived and the real code might be something that evolved and is just missing a refactoring that might not be in the budget right now
  2. we should support defensive programming at any level of granularity
  3. diagnostics still need some work
6 Likes