errors: remove diagnostic message ctors

Now that typed identifiers are used in both derives, constructors for
the `DiagnosticMessage` and `SubdiagnosticMessage` types are not
required.

Signed-off-by: David Wood <david.wood@huawei.com>
This commit is contained in:
David Wood 2022-06-23 16:14:48 +01:00
parent abd3467d47
commit dc90d1d987

View File

@ -258,18 +258,6 @@ pub enum SubdiagnosticMessage {
FluentAttr(FluentId),
}
impl SubdiagnosticMessage {
/// Create a `SubdiagnosticMessage` for the provided Fluent attribute.
pub fn attr(id: impl Into<FluentId>) -> Self {
SubdiagnosticMessage::FluentAttr(id.into())
}
/// Create a `SubdiagnosticMessage` for the provided Fluent identifier.
pub fn message(id: impl Into<FluentId>) -> Self {
SubdiagnosticMessage::FluentIdentifier(id.into())
}
}
/// `From` impl that enables existing diagnostic calls to functions which now take
/// `impl Into<SubdiagnosticMessage>` to continue to work as before.
impl<S: Into<String>> From<S> for SubdiagnosticMessage {
@ -332,11 +320,6 @@ pub fn expect_str(&self) -> &str {
_ => panic!("expected non-translatable diagnostic message"),
}
}
/// Create a `DiagnosticMessage` for the provided Fluent identifier.
pub fn new(id: impl Into<FluentId>) -> Self {
DiagnosticMessage::FluentIdentifier(id.into(), None)
}
}
/// `From` impl that enables existing diagnostic calls to functions which now take