Improve warning message for UnusedVariable
This commit is contained in:
parent
45575cae96
commit
5d3816e984
|
@ -1382,9 +1382,18 @@ pub enum Warning {
|
|||
},
|
||||
|
||||
#[error("I came across an unused variable.\n")]
|
||||
#[diagnostic(help(
|
||||
"No big deal, but you might want to remove it to get rid of that warning."
|
||||
))]
|
||||
#[diagnostic(help("{}", formatdoc! {
|
||||
r#"No big deal, but you might want to remove it to get rid of that warning.
|
||||
|
||||
You should also know that, unlike in typical imperative languages, unused let-bindings are {fully_ignored} in Aiken.
|
||||
They will not produce any side-effect (such as error calls). Programs with or without unused variables are semantically equivalent.
|
||||
|
||||
If you do want to enforce some side-effects, use {keyword_expect} instead of {keyword_let}.
|
||||
"#,
|
||||
fully_ignored = "fully_ignored".if_supports_color(Stderr, |s| s.bold()),
|
||||
keyword_expect = "expect".if_supports_color(Stderr, |s| s.yellow()),
|
||||
keyword_let = "let".if_supports_color(Stderr, |s| s.yellow()),
|
||||
}))]
|
||||
#[diagnostic(code("unused::variable"))]
|
||||
UnusedVariable {
|
||||
#[label("unused")]
|
||||
|
|
Loading…
Reference in New Issue