-
Notifications
You must be signed in to change notification settings - Fork 1.7k
container.len() == 0 #32
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
As a first approximation, we can warn when the self type is in If it's easy enough to check for an |
So, I now know how to get at the type (though I'm not sure what the exact contents would be), so how do we find out if the type has an |
I assume you go through the method map? Everything regarding type check and resolution is done through the tcx (type |
I know how to get the type definition (via |
I'm not sure. Iterating through the You'll have to explore |
I've run into some wrestling with typeck, but at least I feel like I'm on the right track. I'll see once the code compiles, anyway. 😄 However, it's getting late, so I'll resume tomorrow. |
Now it compiles, but the type lookup fails for the simple case |
I've never really played with this so you're basically on your own here, sorry :) Poking people in #rust-internals may help |
The problem is I'd either need to copy large swaths of typeck and patch rustc to allow me to access some private fields/methods, or just wait until the core team makes this available for lints. The latter part opens up some of my time to try and implement some other things, so I guess I'll wait. |
The lint in #60 basically encodes that every impl that has This is intended as a stop-gap solution, but may turn out to be good enough should we surmise that the cost of method lookup is too high. |
For most types, this can be rewritten as
container.is_empty()
.cc rust-lang/rust#23682
The text was updated successfully, but these errors were encountered: