X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibproc_macro%2Fdiagnostic.rs;h=7495468a05b6ccf74febb12fee681d73ab1c1760;hb=17b77913f9fe4dbf99a6ba74e179a7c68a8b1392;hp=65eebb5ec37374a47fcbf356ac7e5e390d8316b8;hpb=7ef11d4f849004e36a61949cfd01cc1a46fac75a;p=rust.git diff --git a/src/libproc_macro/diagnostic.rs b/src/libproc_macro/diagnostic.rs index 65eebb5ec37..7495468a05b 100644 --- a/src/libproc_macro/diagnostic.rs +++ b/src/libproc_macro/diagnostic.rs @@ -51,17 +51,19 @@ pub struct Diagnostic { level: Level, message: String, spans: Vec, - children: Vec + children: Vec, } 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,26 +98,18 @@ 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 /// the given set of `spans`. #[unstable(feature = "proc_macro_diagnostic", issue = "54140")] pub fn spanned(spans: S, level: Level, message: T) -> Diagnostic - where S: MultiSpan, T: Into + where + 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);