Skip to content

Commit 9c1dd0c

Browse files
committed
Fix remaining dogfood errors (internal lints)
1 parent ae6be4f commit 9c1dd0c

File tree

6 files changed

+16
-14
lines changed

6 files changed

+16
-14
lines changed

clippy_lints/src/loops/explicit_iter_loop.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_errors::Applicability;
44
use rustc_hir::{Expr, Mutability};
55
use rustc_lint::LateContext;
66
use rustc_middle::ty::{self, Ty, TyS};
7-
use rustc_span::symbol::sym;
7+
use rustc_span::sym;
88

99
use crate::utils::{is_type_diagnostic_item, match_type, paths};
1010

@@ -55,9 +55,9 @@ fn is_ref_iterable_type(cx: &LateContext<'_>, e: &Expr<'_>) -> bool {
5555
is_iterable_array(ty, cx) ||
5656
is_type_diagnostic_item(cx, ty, sym::vec_type) ||
5757
match_type(cx, ty, &paths::LINKED_LIST) ||
58-
is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) ||
59-
is_type_diagnostic_item(cx, ty, sym!(hashset_type)) ||
60-
is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
58+
is_type_diagnostic_item(cx, ty, sym::hashmap_type) ||
59+
is_type_diagnostic_item(cx, ty, sym::hashset_type) ||
60+
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
6161
match_type(cx, ty, &paths::BINARY_HEAP) ||
6262
match_type(cx, ty, &paths::BTREEMAP) ||
6363
match_type(cx, ty, &paths::BTREESET)

clippy_lints/src/loops/for_kv_map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use crate::utils::{is_type_diagnostic_item, match_type, multispan_sugg, paths, s
44
use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability, Pat, PatKind};
55
use rustc_lint::LateContext;
66
use rustc_middle::ty;
7+
use rustc_span::sym;
78

89
/// Checks for the `FOR_KV_MAP` lint.
910
pub(super) fn check<'tcx>(
@@ -35,7 +36,7 @@ pub(super) fn check<'tcx>(
3536
_ => arg,
3637
};
3738

38-
if is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) || match_type(cx, ty, &paths::BTREEMAP) {
39+
if is_type_diagnostic_item(cx, ty, sym::hashmap_type) || match_type(cx, ty, &paths::BTREEMAP) {
3940
span_lint_and_then(
4041
cx,
4142
FOR_KV_MAP,

clippy_lints/src/loops/manual_memcpy.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ fn is_slice_like<'tcx>(cx: &LateContext<'tcx>, ty: Ty<'_>) -> bool {
328328
_ => false,
329329
};
330330

331-
is_slice || is_type_diagnostic_item(cx, ty, sym::vec_type) || is_type_diagnostic_item(cx, ty, sym!(vecdeque_type))
331+
is_slice || is_type_diagnostic_item(cx, ty, sym::vec_type) || is_type_diagnostic_item(cx, ty, sym::vecdeque_type)
332332
}
333333

334334
fn fetch_cloned_expr<'tcx>(expr: &'tcx Expr<'tcx>) -> &'tcx Expr<'tcx> {

clippy_lints/src/loops/needless_collect.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
2929
then {
3030
let ty = cx.typeck_results().node_type(ty.hir_id);
3131
if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
32-
is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
32+
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
3333
match_type(cx, ty, &paths::BTREEMAP) ||
34-
is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) {
34+
is_type_diagnostic_item(cx, ty, sym::hashmap_type) {
3535
if method.ident.name == sym!(len) {
3636
let span = shorten_needless_collect_span(expr);
3737
span_lint_and_sugg(
@@ -99,7 +99,7 @@ fn check_needless_collect_indirect_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCo
9999
if let Some(GenericArg::Type(ref ty)) = generic_args.args.get(0);
100100
if let ty = cx.typeck_results().node_type(ty.hir_id);
101101
if is_type_diagnostic_item(cx, ty, sym::vec_type) ||
102-
is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) ||
102+
is_type_diagnostic_item(cx, ty, sym::vecdeque_type) ||
103103
match_type(cx, ty, &paths::LINKED_LIST);
104104
if let Some(iter_calls) = detect_iter_and_into_iters(block, *ident);
105105
if iter_calls.len() == 1;

clippy_lints/src/methods/iter_count.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ pub(crate) fn lints<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'_>, iter_args: &'
1414
"slice"
1515
} else if is_type_diagnostic_item(cx, ty, sym::vec_type) {
1616
"Vec"
17-
} else if is_type_diagnostic_item(cx, ty, sym!(vecdeque_type)) {
17+
} else if is_type_diagnostic_item(cx, ty, sym::vecdeque_type) {
1818
"VecDeque"
19-
} else if is_type_diagnostic_item(cx, ty, sym!(hashset_type)) {
19+
} else if is_type_diagnostic_item(cx, ty, sym::hashset_type) {
2020
"HashSet"
21-
} else if is_type_diagnostic_item(cx, ty, sym!(hashmap_type)) {
21+
} else if is_type_diagnostic_item(cx, ty, sym::hashmap_type) {
2222
"HashMap"
2323
} else if match_type(cx, ty, &paths::BTREEMAP) {
2424
"BTreeMap"

clippy_utils/src/eager_or_lazy.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! - or-fun-call
1010
//! - option-if-let-else
1111
12-
use crate::{is_ctor_or_promotable_const_function, is_type_diagnostic_item, match_type, paths};
12+
use crate::{is_ctor_or_promotable_const_function, is_type_diagnostic_item};
1313
use rustc_hir::def::{DefKind, Res};
1414

1515
use rustc_hir::intravisit;
@@ -100,7 +100,8 @@ fn identify_some_potentially_expensive_patterns<'tcx>(cx: &LateContext<'tcx>, ex
100100
ExprKind::Call(..) => !is_ctor_or_promotable_const_function(self.cx, expr),
101101
ExprKind::Index(obj, _) => {
102102
let ty = self.cx.typeck_results().expr_ty(obj);
103-
is_type_diagnostic_item(self.cx, ty, sym::hashmap_type) || match_type(self.cx, ty, &paths::BTREEMAP)
103+
is_type_diagnostic_item(self.cx, ty, sym::hashmap_type)
104+
|| is_type_diagnostic_item(self.cx, ty, sym::BTreeMap)
104105
},
105106
ExprKind::MethodCall(..) => true,
106107
_ => false,

0 commit comments

Comments
 (0)