Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused argument from throw_unresolved_import_error #103953

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions compiler/rustc_resolve/src/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
{
// In the case of a new import line, throw a diagnostic message
// for the previous line.
self.throw_unresolved_import_error(errors, None);
self.throw_unresolved_import_error(errors);
errors = vec![];
}
if seen_spans.insert(err.span) {
Expand Down Expand Up @@ -482,29 +482,21 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
}

if !errors.is_empty() {
self.throw_unresolved_import_error(errors, None);
self.throw_unresolved_import_error(errors);
}
}

fn throw_unresolved_import_error(
&self,
errors: Vec<(String, UnresolvedImportError)>,
span: Option<MultiSpan>,
) {
fn throw_unresolved_import_error(&self, errors: Vec<(String, UnresolvedImportError)>) {
if errors.is_empty() {
return;
}

/// Upper limit on the number of `span_label` messages.
const MAX_LABEL_COUNT: usize = 10;

let (span, msg) = if errors.is_empty() {
(span.unwrap(), "unresolved import".to_string())
} else {
let span = MultiSpan::from_spans(errors.iter().map(|(_, err)| err.span).collect());

let paths = errors.iter().map(|(path, _)| format!("`{}`", path)).collect::<Vec<_>>();

let msg = format!("unresolved import{} {}", pluralize!(paths.len()), paths.join(", "),);

(span, msg)
};
let span = MultiSpan::from_spans(errors.iter().map(|(_, err)| err.span).collect());
let paths = errors.iter().map(|(path, _)| format!("`{}`", path)).collect::<Vec<_>>();
let msg = format!("unresolved import{} {}", pluralize!(paths.len()), paths.join(", "),);

let mut diag = struct_span_err!(self.r.session, span, E0432, "{}", &msg);

Expand Down