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
Emit #[must_use]
in Generate new
assist
#11737
Conversation
e829f65
to
7e05e10
Compare
bors r+ |
Hm, I would say it's better to not do this -- this adds to noise, and IDE noise is something which we should proactively fight. That is, I don't think this At the same time, Now, if you are something like stdlib, it makes sense to |
Maybe it should be configurable? See also https://twitter.com/m_ou_se/status/1481684384096923652 for context. I don't think the |
Interestingly, one of my specific concerns here is that new users would a) be forced to learn about using I do agree that education is a major goal of an IDE, but we should be mindful of contextlessness, which can lead to confusion. I would say, for educational purposes:
|
CC @Walther |
🤔 given the stats for std (<50% of new functions are must use), I am inclined to say that we probably don't even need config here. |
What about the others ( |
And any emission or suggestion of |
Okay, I'll file a revert PR tomorrow morning. |
11826: Revert "Emit #[must_use] in Generate new assist" r=lnicola a=lnicola CC #11737 (comment) Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
Similarlish picture of only must-using the public API
Also, there's a general guideline of composability: we don't need to write everything immediately, we should make it easy to compose a sequence of actions into the desired result. In this sense, the fact that we have completion for attributes is more or less it. Though, it'd be cool to invent some kind of more contextual/interractive UI, which allows you to tweak things like visibility, naming, and attirbutes after you generated the baseline fn. |
I think pattern here is that the attributes were added for public APIs, leaving the private ones unchanged. They might or might not get the attributes if they were written from scratch today. I wonder if @m-ou-se or the libs team would have an opinion on whether |
Closes #11736