Skip to content

Commit 143523a

Browse files
Work around all_symbols_are_used() test limitations
Use clippy symbols as `sym` so that they are caught by the regex.
1 parent d396555 commit 143523a

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

clippy_lints/src/iter_missing_exact_size.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use rustc_hir::{Body, ExprKind, Impl, ImplItemKind, Item, ItemKind, OwnerId, Own
77
use rustc_lint::{LateContext, LateLintPass};
88
use rustc_session::impl_lint_pass;
99
use rustc_span::def_id::DefId;
10-
use rustc_span::sym;
10+
use rustc_span::sym as rustc_sym;
1111

1212
declare_clippy_lint! {
1313
/// ### What it does
@@ -108,7 +108,7 @@ fn size_hint_body<'tcx>(cx: &LateContext<'tcx>, owner_id: OwnerId) -> Option<&'t
108108
.find(|assoc_item| {
109109
assoc_item.expect_trait_impl().is_ok()
110110
&& assoc_item.is_method()
111-
&& assoc_item.name() == clippy_sym::size_hint
111+
&& assoc_item.name() == sym::size_hint
112112
})?;
113113

114114
let node = cx.tcx.expect_hir_owner_node(size_hint_fn.def_id.expect_local());
@@ -138,7 +138,7 @@ impl<'tcx> LateLintPass<'tcx> for IterMissingExactSize {
138138
return;
139139
};
140140
// 3) is it the iterator trait?
141-
if !cx.tcx.is_diagnostic_item(sym::Iterator, trait_id) {
141+
if !cx.tcx.is_diagnostic_item(rustc_sym::Iterator, trait_id) {
142142
return;
143143
}
144144

@@ -152,7 +152,7 @@ impl<'tcx> LateLintPass<'tcx> for IterMissingExactSize {
152152
&& block.stmts.is_empty()
153153
&& let Some(trailing_expr) = block.expr
154154
&& let ExprKind::MethodCall(method_name, receiver, args, _) = trailing_expr.kind
155-
&& method_name.ident.name == clippy_sym::size_hint
155+
&& method_name.ident.name == sym::size_hint
156156
&& let ExprKind::Field(_object, field_name) = receiver.kind
157157
&& args.is_empty()
158158
{

0 commit comments

Comments
 (0)