-
Notifications
You must be signed in to change notification settings - Fork 2.1k
tuple_array_conversions misses implicit &mut -> & conversion subtelty #11100
Copy link
Copy link
Closed
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint group
Metadata
Metadata
Assignees
Labels
C-bugCategory: Clippy is not doing the correct thingCategory: Clippy is not doing the correct thingI-false-positiveIssue: The lint was triggered on code it shouldn't haveIssue: The lint was triggered on code it shouldn't haveI-suggestion-causes-errorIssue: The suggestions provided by this Lint cause an ICE/error when appliedIssue: The suggestions provided by this Lint cause an ICE/error when appliedL-complexityLint: Belongs in the complexity lint groupLint: Belongs in the complexity lint group
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
I have code that uses a double buffering pattern, and as a result has multiple instances of...
&mut [T; 2](representing a borrow of the underlying data store) and turning it into the heterogeneous tuple(&T, &mut T)(representing input and output accessors).[&T; 2](in cases where the distinction between input and output is not necessary and I just want read only access to everything).These conversions are performed using pairs of array and slice patterns, which clippy's
tuple_array_conversionslint will incorrectly suggest turning intofrom()orinto()statements. The tuple <-> array From/Into impl actually are not powerful enough to do this.Lint Name
tuple_array_conversions
Reproducer
I tried this code:
I saw this happen:
I expected to see this happen: clippy understands that this conversion cannot be done via into() and does not suggest it.
Version
Additional Labels
@rustbot label +I-suggestion-causes-error +L-complexity