X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibproc_macro%2Fdiagnostic.rs;h=7495468a05b6ccf74febb12fee681d73ab1c1760;hb=17b77913f9fe4dbf99a6ba74e179a7c68a8b1392;hp=fdf252e53387ecee7dcc4e2073cb55860e9e221e;hpb=67c0f4e2c947cf87f330224d6b764d2777cc8b59;p=rust.git diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs index fdf252e5338..7495468a05b 100644 --- a/src/libproc_macro/diagnostic.rs +++ b/src/libproc_macro/diagnostic.rs @@ -55,13 +55,15 @@ pub struct Diagnostic { } macro_rules! diagnostic_child_methods { - ($spanned:ident, $regular:ident, $level:expr) => ( + ($spanned:ident, $regular:ident, $level:expr) => { /// Adds a new child diagnostic message to `self` with the level /// identified by this method's name with the given `spans` and /// `message`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn $spanned(mut self, spans: S, message: T) -> Diagnostic - where S: MultiSpan, T: Into + where + S: MultiSpan, + T: Into, { self.children.push(Diagnostic::spanned(spans, $level, message)); self @@ -74,7 +76,7 @@ pub fn $regular>(mut self, message: T) -> Diagnostic { self.children.push(Diagnostic::new($level, message)); self } - ) + }; } /// Iterator over the children diagnostics of a `Diagnostic`. @@ -96,7 +98,7 @@ impl Diagnostic { /// Creates a new diagnostic with the given `level` and `message`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn new>(level: Level, message: T) -> Diagnostic { - Diagnostic { level: level, message: message.into(), spans: vec![], children: vec![] } + Diagnostic { level, message: message.into(), spans: vec![], children: vec![] } } /// Creates a new diagnostic with the given `level` and `message` pointing to @@ -107,12 +109,7 @@ pub fn spanned(spans: S, level: Level, message: T) -> Diagnostic S: MultiSpan, T: Into, { - Diagnostic { - level: level, - message: message.into(), - spans: spans.into_spans(), - children: vec![], - } + Diagnostic { level, message: message.into(), spans: spans.into_spans(), children: vec![] } } diagnostic_child_methods!(span_error, error, Level::Error);