1
Fork 0

review comment

This commit is contained in:
Michael Goulet 2023-01-09 18:07:34 +00:00
parent 050bc95ce2
commit 1d66a675bb
2 changed files with 13 additions and 8 deletions

View file

@ -161,7 +161,7 @@ impl<'a> Resolver<'a> {
found_use, found_use,
DiagnosticMode::Normal, DiagnosticMode::Normal,
path, path,
None, "",
); );
err.emit(); err.emit();
} else if let Some((span, msg, sugg, appl)) = suggestion { } else if let Some((span, msg, sugg, appl)) = suggestion {
@ -691,7 +691,7 @@ impl<'a> Resolver<'a> {
FoundUse::Yes, FoundUse::Yes,
DiagnosticMode::Pattern, DiagnosticMode::Pattern,
vec![], vec![],
None, "",
); );
} }
err err
@ -1346,7 +1346,7 @@ impl<'a> Resolver<'a> {
FoundUse::Yes, FoundUse::Yes,
DiagnosticMode::Normal, DiagnosticMode::Normal,
vec![], vec![],
None, "",
); );
if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) { if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) {
@ -2328,7 +2328,7 @@ pub(crate) fn import_candidates(
use_placement_span: Option<Span>, use_placement_span: Option<Span>,
candidates: &[ImportSuggestion], candidates: &[ImportSuggestion],
mode: DiagnosticMode, mode: DiagnosticMode,
append: Option<&str>, append: &str,
) { ) {
show_candidates( show_candidates(
session, session,
@ -2358,12 +2358,11 @@ fn show_candidates(
found_use: FoundUse, found_use: FoundUse,
mode: DiagnosticMode, mode: DiagnosticMode,
path: Vec<Segment>, path: Vec<Segment>,
append: Option<&str>, append: &str,
) { ) {
if candidates.is_empty() { if candidates.is_empty() {
return; return;
} }
let append = append.unwrap_or("");
let mut accessible_path_strings: Vec<(String, &str, Option<DefId>, &Option<String>)> = let mut accessible_path_strings: Vec<(String, &str, Option<DefId>, &Option<String>)> =
Vec::new(); Vec::new();

View file

@ -554,7 +554,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
Some(err.span), Some(err.span),
&candidates, &candidates,
DiagnosticMode::Import, DiagnosticMode::Import,
(source != target).then(|| format!(" as {target}")).as_deref(), (source != target)
.then(|| format!(" as {target}"))
.as_deref()
.unwrap_or(""),
), ),
ImportKind::Single { nested: true, source, target, .. } => { ImportKind::Single { nested: true, source, target, .. } => {
import_candidates( import_candidates(
@ -564,7 +567,10 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
None, None,
&candidates, &candidates,
DiagnosticMode::Normal, DiagnosticMode::Normal,
(source != target).then(|| format!(" as {target}")).as_deref(), (source != target)
.then(|| format!(" as {target}"))
.as_deref()
.unwrap_or(""),
); );
} }
_ => {} _ => {}