Dont clobber as ..
rename in import suggestion
This commit is contained in:
parent
9e2536b938
commit
d2404d6dca
5 changed files with 55 additions and 5 deletions
|
@ -161,6 +161,7 @@ impl<'a> Resolver<'a> {
|
|||
found_use,
|
||||
DiagnosticMode::Normal,
|
||||
path,
|
||||
None,
|
||||
);
|
||||
err.emit();
|
||||
} else if let Some((span, msg, sugg, appl)) = suggestion {
|
||||
|
@ -690,6 +691,7 @@ impl<'a> Resolver<'a> {
|
|||
FoundUse::Yes,
|
||||
DiagnosticMode::Pattern,
|
||||
vec![],
|
||||
None,
|
||||
);
|
||||
}
|
||||
err
|
||||
|
@ -1344,6 +1346,7 @@ impl<'a> Resolver<'a> {
|
|||
FoundUse::Yes,
|
||||
DiagnosticMode::Normal,
|
||||
vec![],
|
||||
None,
|
||||
);
|
||||
|
||||
if macro_kind == MacroKind::Derive && (ident.name == sym::Send || ident.name == sym::Sync) {
|
||||
|
@ -2325,6 +2328,7 @@ pub(crate) fn import_candidates(
|
|||
use_placement_span: Option<Span>,
|
||||
candidates: &[ImportSuggestion],
|
||||
mode: DiagnosticMode,
|
||||
append: Option<&str>,
|
||||
) {
|
||||
show_candidates(
|
||||
session,
|
||||
|
@ -2336,6 +2340,7 @@ pub(crate) fn import_candidates(
|
|||
FoundUse::Yes,
|
||||
mode,
|
||||
vec![],
|
||||
append,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2353,10 +2358,12 @@ fn show_candidates(
|
|||
found_use: FoundUse,
|
||||
mode: DiagnosticMode,
|
||||
path: Vec<Segment>,
|
||||
append: Option<&str>,
|
||||
) {
|
||||
if candidates.is_empty() {
|
||||
return;
|
||||
}
|
||||
let append = append.unwrap_or("");
|
||||
|
||||
let mut accessible_path_strings: Vec<(String, &str, Option<DefId>, &Option<String>)> =
|
||||
Vec::new();
|
||||
|
@ -2417,7 +2424,7 @@ fn show_candidates(
|
|||
// produce an additional newline to separate the new use statement
|
||||
// from the directly following item.
|
||||
let additional_newline = if let FoundUse::Yes = found_use { "" } else { "\n" };
|
||||
candidate.0 = format!("{}{};\n{}", add_use, &candidate.0, additional_newline);
|
||||
candidate.0 = format!("{add_use}{}{append};\n{additional_newline}", &candidate.0);
|
||||
}
|
||||
|
||||
err.span_suggestions(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue