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
Add more #[must_use]
attributes for appropriate functions
#457
Conversation
Let's just disable this lint: it forces to add too much boilerplate attributes which is unusable in most cases |
I don't think that they're useless -- at least, they reduce the risk of bugs. @WaffleLapkin, can we wrap this |
@p0lunin we can't disable this lint, because it isn't enabled in the first place.
The methods are not useless, but calling them and then not using their output is useless since it does nothing.
We probably could, but I don't think we should, IMO it will create more problems than it'll solve. |
That's right, so maybe we should only annotate builder-related functionality? |
Any pure function is just a transformation of data, so it's kind of builder-related in some sense? 🤔 IMO it would be better if Rust supported the opposite - marking functions as |
I mean request builders specifically, in teloxide-core. Or they are already marked with |
@Hirrolot the request builders are not fully marked yet, but I'm currently working on a PR that resolves that. I don't see though why we should only mark as let input: &str = ...;
escape(input); // user may have expected that this would change `input`
bot.send_message(..., format!("Input: {}", input)).await?; // Oops |
It's fair. However, I don't see much sense in |
Telegram bots are a common thing to do for beginners, which can struggle to understand that a |
950cb20
to
52096d2
Compare
(rebased to update CI) |
Add more `#[must_use]` attributes for appropriate functions Former-commit-id: a36f2b0
See #453
This PR marks all functions warned by
clippy::must_use_candidate
as#[must_use]