-
-
Notifications
You must be signed in to change notification settings - Fork 354
feature request: attach a reason
parameter to @nodiscard
#3173
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
|
Actually this might be a good first issue 😂 There is an almost identical feature, but for
I believe for
|
not sure... some annotations here aren't compatible with EmmyLua, and I don't quite want to have two language servers installed at a time, plus, I'm used to this one |
Note
I couldn't find an issue for this. sorry if there's a duplicate.
I propose updating the
@nodiscard
annotation to add a "reason" as to why not discard the value:---@nodiscard [<reason>]
this would mirror Rust's
#[must_use = "reason"]
annotation.example:
discarding the output would then display the warning:
note the colon at the end of "discarded".
if not given a reason, it would fall-back to the usual message, with "discarded" ending with a dot and no further explanation
(yes, I'm aware that reason in the Object:extend example isn't exactly... professional 😅)
The text was updated successfully, but these errors were encountered: