slightly rework hint for 'ImpliclyDiscardedExpression'

This commit is contained in:
KtorZ 2023-01-19 17:25:18 +01:00
parent 092151d6a0
commit bb82b1bc1e
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 6 additions and 1 deletions

View File

@ -494,7 +494,12 @@ impl Diagnostic for Error {
Self::FunctionTypeInData { .. } => Some(Box::new("Data types can't have functions in them due to how Plutus Data works.")), Self::FunctionTypeInData { .. } => Some(Box::new("Data types can't have functions in them due to how Plutus Data works.")),
Self::ImplicityDiscardedExpression { .. } => Some(Box::new("Everything is an expression and returns a value.\nTry assigning this expression to a variable.")), Self::ImplicityDiscardedExpression { .. } => Some(Box::new(formatdoc! {
r#"A function can contain a sequence of expressions. However, any expression but the last one must be assign to a variable using the {let_keyword} keyword. If you really wish to discard an expression that is unused, you can prefix its name with '{discard}'.
"#
, let_keyword = "let".yellow()
, discard = "_".yellow()
})),
Self::IncorrectFieldsArity { .. } => None, Self::IncorrectFieldsArity { .. } => None,
Self::IncorrectFunctionCallArity { expected, .. } => Some(Box::new(formatdoc! { Self::IncorrectFunctionCallArity { expected, .. } => Some(Box::new(formatdoc! {