Skip to content

Commit e0eb29c

Browse files
committed
Applying PR suggestions (mostly typos)
Co-authored-by: flip1995 <[email protected]> Co-authored-by: phansch <[email protected]>
1 parent 62cafe2 commit e0eb29c

File tree

3 files changed

+19
-10
lines changed

3 files changed

+19
-10
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ rustc_tools_util = { version = "0.2.0", path = "rustc_tools_util" }
5252
deny-warnings = []
5353
integration = ["tempfile"]
5454
internal-lints = ["clippy_lints/internal-lints"]
55-
metadata-collector-lint = ["clippy_lints/metadata-collector-lint"]
55+
metadata-collector-lint = ["internal-lints", "clippy_lints/metadata-collector-lint"]
5656

5757
[package.metadata.rust-analyzer]
5858
# This package uses #[feature(rustc_private)]

clippy_lints/src/utils/internal_lints/metadata_collector.rs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ use std::io::prelude::*;
2727
use std::path::Path;
2828

2929
use crate::utils::internal_lints::is_lint_ref_type;
30-
use crate::utils::{
31-
last_path_segment, match_function_call, match_path, match_type, paths, span_lint, walk_ptrs_ty_depth,
30+
use clippy_utils::{
31+
diagnostics::span_lint, last_path_segment, match_function_call, match_path, paths, ty::match_type,
32+
ty::walk_ptrs_ty_depth,
3233
};
3334

3435
/// This is the output file of the lint collector.
@@ -107,7 +108,7 @@ pub struct MetadataCollector {
107108
///
108109
/// We use a Heap here to have the lints added in alphabetic order in the export
109110
lints: BinaryHeap<LintMetadata>,
110-
applicability_into: FxHashMap<String, ApplicabilityInfo>,
111+
applicability_info: FxHashMap<String, ApplicabilityInfo>,
111112
}
112113

113114
impl Drop for MetadataCollector {
@@ -120,7 +121,7 @@ impl Drop for MetadataCollector {
120121
return;
121122
}
122123

123-
let mut applicability_info = std::mem::take(&mut self.applicability_into);
124+
let mut applicability_info = std::mem::take(&mut self.applicability_info);
124125

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

274275
for (lint_name, applicability, is_multi_part) in emission_info.drain(..) {
275-
let app_info = self.applicability_into.entry(lint_name).or_default();
276+
let app_info = self.applicability_info.entry(lint_name).or_default();
276277
app_info.applicability = applicability;
277278
app_info.is_multi_part_suggestion = is_multi_part;
278279
}
@@ -354,7 +355,7 @@ fn lint_collection_error_item(cx: &LateContext<'_>, item: &Item<'_>, message: &s
354355
cx,
355356
INTERNAL_METADATA_COLLECTOR,
356357
item.ident.span,
357-
&format!("Metadata collection error for `{}`: {}", item.ident.name, message),
358+
&format!("metadata collection error for `{}`: {}", item.ident.name, message),
358359
);
359360
}
360361

@@ -569,7 +570,7 @@ impl<'a, 'hir> IsMultiSpanScanner<'a, 'hir> {
569570
}
570571

571572
/// Add a new single expression suggestion to the counter
572-
fn add_singe_span_suggestion(&mut self) {
573+
fn add_single_span_suggestion(&mut self) {
573574
self.suggestion_count += 1;
574575
}
575576

@@ -604,7 +605,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
604605
.any(|func_path| match_function_call(self.cx, fn_expr, func_path).is_some());
605606
if found_function {
606607
// These functions are all multi part suggestions
607-
self.add_singe_span_suggestion()
608+
self.add_single_span_suggestion()
608609
}
609610
},
610611
ExprKind::MethodCall(path, _path_span, arg, _arg_span) => {
@@ -616,7 +617,7 @@ impl<'a, 'hir> intravisit::Visitor<'hir> for IsMultiSpanScanner<'a, 'hir> {
616617
if *is_multi_part {
617618
self.add_multi_part_suggestion();
618619
} else {
619-
self.add_singe_span_suggestion();
620+
self.add_single_span_suggestion();
620621
}
621622
break;
622623
}

clippy_utils/src/diagnostics.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
//! Clippy wrappers around rustc's diagnostic functions.
2+
//!
3+
//! These functions are used by the `INTERNAL_METADATA_COLLECTOR` lint to collect the corresponding
4+
//! lint applicability. Please make sure that you update the `LINT_EMISSION_FUNCTIONS` variable in
5+
//! `clippy_lints::utils::internal_lints::metadata_collector` when a new function is added
6+
//! or renamed.
7+
//!
8+
//! Thank you!
9+
//! ~The `INTERNAL_METADATA_COLLECTOR` lint
210
311
use rustc_errors::{Applicability, DiagnosticBuilder};
412
use rustc_hir::HirId;

0 commit comments

Comments
 (0)