From 5dea5d7549acbd85f7c2a7b63c8d8aeeb5f6de07 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sun, 22 Aug 2021 17:16:24 +0200 Subject: Say what things are, instead of what they are not. --- compiler/rustc_resolve/src/diagnostics.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'compiler/rustc_resolve') diff --git a/compiler/rustc_resolve/src/diagnostics.rs b/compiler/rustc_resolve/src/diagnostics.rs index 60f0ad9e30d..088596b2cbc 100644 --- a/compiler/rustc_resolve/src/diagnostics.rs +++ b/compiler/rustc_resolve/src/diagnostics.rs @@ -971,20 +971,19 @@ impl<'a> Resolver<'a> { false, ident.span, ) { - let it_is = match binding.macro_kind() { - Some(MacroKind::Bang) => "it is a function-like macro".to_string(), - Some(kind) => format!("it is {} {}", kind.article(), kind.descr_expected()), - None => format!( - "it is not {} {}", - macro_kind.article(), - macro_kind.descr_expected() - ), + let desc = match binding.macro_kind() { + Some(MacroKind::Bang) => "a function-like macro".to_string(), + Some(kind) => format!("{} {}", kind.article(), kind.descr_expected()), + None => { + let res = binding.res(); + format!("{} {}", res.article(), res.descr()) + } }; if let crate::NameBindingKind::Import { import, .. } = binding.kind { if !import.span.is_dummy() { err.span_note( import.span, - &format!("`{}` is imported here, but {}", ident, it_is), + &format!("`{}` is imported here, but it is {}", ident, desc), ); // Silence the 'unused import' warning we might get, // since this diagnostic already covers that import. @@ -992,7 +991,7 @@ impl<'a> Resolver<'a> { return; } } - err.note(&format!("`{}` is in scope, but {}", ident, it_is)); + err.note(&format!("`{}` is in scope, but it is {}", ident, desc)); return; } } -- cgit 1.4.1-3-g733a5