Convert some impl Subdiagnostics to derives
This commit is contained in:
parent
635dcd819a
commit
ab4891ce74
3 changed files with 14 additions and 36 deletions
|
|
@ -1975,27 +1975,17 @@ pub(crate) struct OverflowingBinHex<'a> {
|
|||
pub sign_bit_sub: Option<OverflowingBinHexSignBitSub<'a>>,
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum OverflowingBinHexSign {
|
||||
#[note(
|
||||
"the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}` and will become `{$actually}{$ty}`"
|
||||
)]
|
||||
Positive,
|
||||
#[note("the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`")]
|
||||
#[note("and the value `-{$lit}` will become `{$actually}{$ty}`")]
|
||||
Negative,
|
||||
}
|
||||
|
||||
impl Subdiagnostic for OverflowingBinHexSign {
|
||||
fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
|
||||
match self {
|
||||
OverflowingBinHexSign::Positive => {
|
||||
diag.note(inline_fluent!("the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}` and will become `{$actually}{$ty}`"));
|
||||
}
|
||||
OverflowingBinHexSign::Negative => {
|
||||
diag.note(inline_fluent!(
|
||||
"the literal `{$lit}` (decimal `{$dec}`) does not fit into the type `{$ty}`"
|
||||
));
|
||||
diag.note(inline_fluent!("and the value `-{$lit}` will become `{$actually}{$ty}`"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Subdiagnostic)]
|
||||
pub(crate) enum OverflowingBinHexSub<'a> {
|
||||
#[suggestion(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue