-
-
Notifications
You must be signed in to change notification settings - Fork 75
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
New lint: Trait method #[must_use]
added
#284
Conversation
Looks good so far! |
Unfortunately I'm in a spot of bother with the query. Say we have the following code: pub trait Foo {
#[must_use]
fn bar();
} The thing is - how do we access the method |
I think it requires a bit of new schema. The method The body presence or absence information comes from the We have a few different options here:
Perhaps there are other alternatives as well. What do you think would be the best approach? |
The
This is almost perfect, but I see one point of contention - the
This is the sweet spot in my opinion - if we could solve the problem of "what trait am I inside?" by adding a field for that as well, we would be able to query for trait methods and even distinguish declared and provided methods. I would add the
This could be more wise thinking about future schema additions than the previous one if we could know what trait the method is in with the derived type. I'm only not sure if there would be anything else deriving from it in the future - if not, would it be worth it to have an Interface with just two objects deriving it? I'm not experienced enough with project structuring to tell, though. Overall, I would probably go with the middle option since it appears to me as the one that is not just sufficient, but also reliable and beneficial for the whole schema. |
Ah sorry for the confusion, on traits
Would our current way of ensuring types are "the same" across
If we're adding I'm guessing my confusing wording of the first option probably disqualified it immediately from your consideration. Has any of this changed your mind? |
Yes, the first option is now definitely the best one! And combined with
will allow for successfully accessing the trait methods. If this is the final choice, I will go for these additions to the schema, as well as the One more question, related to the lint but not the schema - turns out we don't have a check against turning the method |
Sounds great! Go for it!
I think that should be a new lint, and not reported here — it would be great to have a test case for it. If you're interested in writing that new lint as well, go for it! And yes, feel free to open an issue for it. I believe this new lint is mentioned in #5 so just make sure to link it to the appropriate entry (or make one if I'm misremembering and it isn't actually in the list there). |
Will do all of these! Thank you for answering with great suggestions and details, I believe there are no more uncertainties as far as this lint goes for now, great to have it all be clear :) |
Awesome, I'm happy to help and excited to help you keep building! |
…ared `#[must_use] methods.
@SmolSir just checking in since it's been a couple of months since the last activity on this PR — are you still interested in working on this? |
Yes, I just shifted the focus to writing our thesis after the winter break. I planned to code again after writing one more chapter in about a week from now if that's not a problem! |
Not a problem, I just wanted to figure out whether you're still interested in this PR, or else close it to let someone else take over the task. |
@SmolSir checking in again, are you still planning on finishing up this PR or should I reassign it to someone else? |
I'm sorry for blocking this for so long, last time when I said that I will sit down and finish it we got overwhelmed by homeworks 😞 Currently my plan is to study hard for our bachelor's exam at the end of June, so I can get back to this no sooner than July. If you have somebody to assign this to sooner than that, feel free to do so (I will still keep my eye on this in case there were any questions about what has been done so far). |
No worries, good luck with exams! |
Closing for staleness (no worries!), and I'm sure another contributor can pick this up soon. |
This is a part of solving #159, as well as splitting #268 into more manageable, smaller PRs.
Implements the check against adding
#[must_use]
attribute to a public Trait's method.