Align warnings message's style with errors.

This commit is contained in:
KtorZ 2022-12-28 18:45:04 +01:00
parent 7c1b8e8f3b
commit c4c0ace3a6
No known key found for this signature in database
GPG Key ID: 33173CB6F77F4277
1 changed files with 40 additions and 12 deletions

View File

@ -1361,7 +1361,8 @@ impl Diagnostic for Error {
#[derive(Debug, PartialEq, Clone, thiserror::Error, Diagnostic)]
pub enum Warning {
#[error("Todo\n")]
#[error("I found a todo left in the code.\n")]
#[diagnostic(help("You probably want to replace that one with real code... eventually."))]
Todo {
kind: TodoKind,
#[label]
@ -1369,31 +1370,38 @@ pub enum Warning {
tipo: Arc<Type>,
},
#[error("Implicitly discarded result\n")]
#[error(
"I realized the following expression returned a result that is implicitly discarded.\n"
)]
#[diagnostic(help(
"You can use the '_' symbol should you want to explicitly discard a result."
))]
ImplicitlyDiscardedResult {
#[label]
location: Span,
},
#[error("Unused literal\n")]
#[error("I found a literal that is unused.\n")]
UnusedLiteral {
#[label]
location: Span,
},
#[error("Record update with no fields\n")]
#[error("I found a record update with no fields; effectively updating nothing.\n")]
#[diagnostic(url("https://aiken-lang.org/language-tour/custom-types#record-updates"))]
NoFieldsRecordUpdate {
#[label]
location: Span,
},
#[error("Record update using all fields\n")]
#[error("I found a record update using all fields; thus redundant.\n")]
#[diagnostic(url("https://aiken-lang.org/language-tour/custom-types#record-updates"))]
AllFieldsRecordUpdate {
#[label]
location: Span,
},
#[error("Unused type {name}\n")]
#[error("I discovered an unused type: '{}'.\n", name.purple())]
UnusedType {
#[label]
location: Span,
@ -1401,7 +1409,10 @@ pub enum Warning {
name: String,
},
#[error("Unused constructor {name}\n")]
#[error("I discovered an unused constructor: '{}'.\n", name.purple())]
#[diagnostic(help(
"No big deal, but you might want to remove it to get rid of that warning."
))]
UnusedConstructor {
#[label]
location: Span,
@ -1409,35 +1420,52 @@ pub enum Warning {
name: String,
},
#[error("Unused imported value {name}\n")]
#[error("I discovered an unused imported value: '{}'.\n", name.purple())]
#[diagnostic(help(
"No big deal, but you might want to remove it to get rid of that warning."
))]
UnusedImportedValue {
#[label]
location: Span,
name: String,
},
#[error("Unused imported module {name}\n")]
#[error("I discovered an unused imported module: '{}'.\n", name.purple())]
#[diagnostic(help(
"No big deal, but you might want to remove it to get rid of that warning."
))]
UnusedImportedModule {
#[label]
location: Span,
name: String,
},
#[error("Unused private module constant {name}\n")]
#[error("I found an unused (private) module constant: '{}'.\n", name.purple())]
#[diagnostic(help(
"Perhaps your forgot to make it public using the 'pub' keyword?\n\
Otherwise, you might want to get rid of it altogether."
))]
UnusedPrivateModuleConstant {
#[label]
location: Span,
name: String,
},
#[error("Unused private function {name}\n")]
#[error("I found an unused private function: '{}'.\n", name.purple())]
#[diagnostic(help(
"Perhaps your forgot to make it public using the 'pub' keyword?\n\
Otherwise, you might want to get rid of it altogether."
))]
UnusedPrivateFunction {
#[label]
location: Span,
name: String,
},
#[error("Unused variable {name}\n")]
#[error("I came across an unused variable: '{}'.\n", name.purple())]
#[diagnostic(help(
"No big deal, but you might want to remove it to get rid of that warning."
))]
UnusedVariable {
#[label]
location: Span,