Skip to content

Commit

Permalink
Applying PR suggestions (mostly typos)
Browse files Browse the repository at this point in the history
Co-authored-by: flip1995 <[email protected]>
Co-authored-by: phansch <[email protected]>
  • Loading branch information
xFrednet committed Mar 31, 2021
1 parent c8e9d15 commit b4d8d1d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
14 changes: 7 additions & 7 deletions clippy_lints/src/utils/internal_lints/metadata_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ pub struct MetadataCollector {
///
/// We use a Heap here to have the lints added in alphabetic order in the export
lints: BinaryHeap<LintMetadata>,
applicability_into: FxHashMap<String, ApplicabilityInfo>,
applicability_info: FxHashMap<String, ApplicabilityInfo>,
}

impl Drop for MetadataCollector {
Expand All @@ -120,7 +120,7 @@ impl Drop for MetadataCollector {
return;
}

let mut applicability_info = std::mem::take(&mut self.applicability_into);
let mut applicability_info = std::mem::take(&mut self.applicability_info);

// Mapping the final data
let mut lints = std::mem::take(&mut self.lints).into_sorted_vec();
Expand Down Expand Up @@ -272,7 +272,7 @@ impl<'hir> LateLintPass<'hir> for MetadataCollector {
}

for (lint_name, applicability, is_multi_part) in emission_info.drain(..) {
let app_info = self.applicability_into.entry(lint_name).or_default();
let app_info = self.applicability_info.entry(lint_name).or_default();
app_info.applicability = applicability;
app_info.is_multi_part_suggestion = is_multi_part;
}
Expand Down Expand Up @@ -354,7 +354,7 @@ fn lint_collection_error_item(cx: &LateContext<'_>, item: &Item<'_>, message: &s
cx,
INTERNAL_METADATA_COLLECTOR,
item.ident.span,
&format!("Metadata collection error for `{}`: {}", item.ident.name, message),
&format!("metadata collection error for `{}`: {}", item.ident.name, message),
);
}

Expand Down Expand Up @@ -569,7 +569,7 @@ impl<'a, 'hir> IsMultiSpanScanner<'a, 'hir> {
}

/// Add a new single expression suggestion to the counter
fn add_singe_span_suggestion(&mut self) {
fn add_single_span_suggestion(&mut self) {
self.suggestion_count += 1;
}

Expand Down Expand Up @@ -604,7 +604,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
.any(|func_path| match_function_call(self.cx, fn_expr, func_path).is_some());
if found_function {
// These functions are all multi part suggestions
self.add_singe_span_suggestion()
self.add_single_span_suggestion()
}
},
ExprKind::MethodCall(path, _path_span, arg, _arg_span) => {
Expand All @@ -616,7 +616,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
if *is_multi_part {
self.add_multi_part_suggestion();
} else {
self.add_singe_span_suggestion();
self.add_single_span_suggestion();
}
break;
}
Expand Down
8 changes: 8 additions & 0 deletions clippy_utils/src/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
//! Clippy wrappers around rustc's diagnostic functions.
//!
//! These functions are used by the INTERNAL_METADATA_COLLECTOR lint to collect the corresponding
//! lint applicability. Please make sure that you update the `LINT_EMISSION_FUNCTIONS` variable in
//! `clippy_lints::utils::internal_lints::metadata_collector` when a new function is added
//! or renamed.
//!
//! Thank you!
//! ~The INTERNAL_METADATA_COLLECTOR lint
use rustc_errors::{Applicability, DiagnosticBuilder};
use rustc_hir::HirId;
Expand Down

0 comments on commit b4d8d1d

Please sign in to comment.