-
Notifications
You must be signed in to change notification settings - Fork 1.6k
lint unnecessary derefs #234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I do have some instances of this in So unless we use a blacklist (same old, same old 😄), we'll have a real hard time trying to avert false positives. |
Yeah, as far as I understand it, the adjustment is done for function arguments and method/field lookup. But inner types are not adjusted, so once you have This would have to check function arguments against the parameter types, and we'll have to find if rustc provides an API that does the "is type A compatible with type B after adjusting" check. If it doesn't, this is going to be hard :) |
Agreed, you either end up building your own types at runtime (hard) or rewriting most of the type adjustment logic (probably harder). |
Even just supporting the case |
I wonder if |
That's a good point. The lint could be reported only if |
We need to ignore function with generic type. |
I've seen uses of
&*s
wheres
is aString
; this can be reduced to&s
when calling a function that accepts&str
.Similarly, in the AST, I've seen (in clippy and racer)
&**x
or&*x
where justx
or&x
is fine; call syntax will autoderef a&P<T>
to a&T
.However, I don't really know yet how to do this in a general way.
The text was updated successfully, but these errors were encountered: