Skip to content

Commit dedc380

Browse files
committed
Apply fixes from lint
1 parent 6b1779b commit dedc380

27 files changed

+50
-50
lines changed

clippy_lints/src/casts/cast_ptr_alignment.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) {
2020
);
2121
lint_cast_ptr_alignment(cx, expr, cast_from, cast_to);
2222
} else if let ExprKind::MethodCall(method_path, self_arg, [], _) = &expr.kind {
23-
if method_path.ident.name == sym!(cast)
23+
if method_path.ident.name.as_str() == "cast"
2424
&& let Some(generic_args) = method_path.args
2525
&& let [GenericArg::Type(cast_to)] = generic_args.args
2626
// There probably is no obvious reason to do this, just to be consistent with `as` cases.

clippy_lints/src/explicit_write.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ impl<'tcx> LateLintPass<'tcx> for ExplicitWrite {
5858
// match call to write_fmt
5959
&& let ExprKind::MethodCall(write_fun, write_recv, [write_arg], _) = *look_in_block(cx, &write_call.kind)
6060
&& let ExprKind::Call(write_recv_path, []) = write_recv.kind
61-
&& write_fun.ident.name == sym!(write_fmt)
61+
&& write_fun.ident.name.as_str() == "write_fmt"
6262
&& let Some(def_id) = path_def_id(cx, write_recv_path)
6363
{
6464
// match calls to std::io::stdout() / std::io::stderr ()

clippy_lints/src/from_raw_with_void_ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ impl LateLintPass<'_> for FromRawWithVoidPtr {
4141
fn check_expr(&mut self, cx: &LateContext<'_>, expr: &Expr<'_>) {
4242
if let ExprKind::Call(box_from_raw, [arg]) = expr.kind
4343
&& let ExprKind::Path(QPath::TypeRelative(ty, seg)) = box_from_raw.kind
44-
&& seg.ident.name == sym!(from_raw)
44+
&& seg.ident.name.as_str() == "from_raw"
4545
&& let Some(type_str) = path_def_id(cx, ty).and_then(|id| def_id_matches_type(cx, id))
4646
&& let arg_kind = cx.typeck_results().expr_ty(arg).kind()
4747
&& let ty::RawPtr(ty, _) = arg_kind

clippy_lints/src/implicit_hasher.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'_, '_, 'tcx> {
340340
if self.cx.tcx.is_diagnostic_item(sym::HashMap, ty_did) {
341341
if method.ident.name == sym::new {
342342
self.suggestions.insert(e.span, "HashMap::default()".to_string());
343-
} else if method.ident.name == sym!(with_capacity) {
343+
} else if method.ident.name.as_str() == "with_capacity" {
344344
self.suggestions.insert(
345345
e.span,
346346
format!(
@@ -352,7 +352,7 @@ impl<'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'_, '_, 'tcx> {
352352
} else if self.cx.tcx.is_diagnostic_item(sym::HashSet, ty_did) {
353353
if method.ident.name == sym::new {
354354
self.suggestions.insert(e.span, "HashSet::default()".to_string());
355-
} else if method.ident.name == sym!(with_capacity) {
355+
} else if method.ident.name.as_str() == "with_capacity" {
356356
self.suggestions.insert(
357357
e.span,
358358
format!(

clippy_lints/src/infinite_iter.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn is_infinite(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
157157
.and(cap);
158158
}
159159
}
160-
if method.ident.name == sym!(flat_map) && args.len() == 1 {
160+
if method.ident.name.as_str() == "flat_map" && args.len() == 1 {
161161
if let ExprKind::Closure(&Closure { body, .. }) = args[0].kind {
162162
let body = cx.tcx.hir().body(body);
163163
return is_infinite(cx, body.value);
@@ -224,7 +224,7 @@ fn complete_infinite_iter(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
224224
return MaybeInfinite.and(is_infinite(cx, receiver));
225225
}
226226
}
227-
if method.ident.name == sym!(last) && args.is_empty() {
227+
if method.ident.name.as_str() == "last" && args.is_empty() {
228228
let not_double_ended = cx
229229
.tcx
230230
.get_diagnostic_item(sym::DoubleEndedIterator)
@@ -234,7 +234,7 @@ fn complete_infinite_iter(cx: &LateContext<'_>, expr: &Expr<'_>) -> Finiteness {
234234
if not_double_ended {
235235
return is_infinite(cx, receiver);
236236
}
237-
} else if method.ident.name == sym!(collect) {
237+
} else if method.ident.name.as_str() == "collect" {
238238
let ty = cx.typeck_results().expr_ty(expr);
239239
if matches!(
240240
get_type_diagnostic_name(cx, ty),

clippy_lints/src/iter_without_into_iter.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ impl LateLintPass<'_> for IterWithoutIntoIter {
142142
ty.peel_refs().is_slice() || get_adt_inherent_method(cx, ty, expected_method_name).is_some()
143143
})
144144
&& let Some(iter_assoc_span) = imp.items.iter().find_map(|item| {
145-
if item.ident.name == sym!(IntoIter) {
145+
if item.ident.name.as_str() == "IntoIter" {
146146
Some(cx.tcx.hir().impl_item(item.id).expect_type().span)
147147
} else {
148148
None

clippy_lints/src/manual_hash_one.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl LateLintPass<'_> for ManualHashOne {
6868
&& let Some(init) = local.init
6969
&& !init.span.from_expansion()
7070
&& let ExprKind::MethodCall(seg, build_hasher, [], _) = init.kind
71-
&& seg.ident.name == sym!(build_hasher)
71+
&& seg.ident.name.as_str() == "build_hasher"
7272

7373
&& let Node::Stmt(local_stmt) = cx.tcx.parent_hir_node(local.hir_id)
7474
&& let Node::Block(block) = cx.tcx.parent_hir_node(local_stmt.hir_id)
@@ -96,7 +96,7 @@ impl LateLintPass<'_> for ManualHashOne {
9696
&& let Node::Expr(finish_expr) = cx.tcx.parent_hir_node(path_expr.hir_id)
9797
&& !finish_expr.span.from_expansion()
9898
&& let ExprKind::MethodCall(seg, _, [], _) = finish_expr.kind
99-
&& seg.ident.name == sym!(finish)
99+
&& seg.ident.name.as_str() == "finish"
100100

101101
&& self.msrv.meets(msrvs::BUILD_HASHER_HASH_ONE)
102102
{

clippy_lints/src/manual_is_ascii_check.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualIsAsciiCheck {
105105
check_is_ascii(cx, macro_call.span, recv, &range, None);
106106
}
107107
} else if let ExprKind::MethodCall(path, receiver, [arg], ..) = expr.kind
108-
&& path.ident.name == sym!(contains)
108+
&& path.ident.name.as_str() == "contains"
109109
&& let Some(higher::Range {
110110
start: Some(start),
111111
end: Some(end),

clippy_lints/src/matches/redundant_guards.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use rustc_hir::def::{DefKind, Res};
1010
use rustc_hir::{Arm, BinOpKind, Expr, ExprKind, MatchSource, Node, PatKind, UnOp};
1111
use rustc_lint::LateContext;
1212
use rustc_span::symbol::Ident;
13-
use rustc_span::{Span, Symbol, sym};
13+
use rustc_span::{Span, sym};
1414
use std::borrow::Cow;
1515
use std::ops::ControlFlow;
1616

@@ -95,15 +95,15 @@ pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, arms: &'tcx [Arm<'tcx>], msrv:
9595
} else if let ExprKind::MethodCall(path, recv, args, ..) = guard.kind
9696
&& let Some(binding) = get_pat_binding(cx, recv, outer_arm)
9797
{
98-
check_method_calls(cx, outer_arm, path.ident.name, recv, args, guard, &binding);
98+
check_method_calls(cx, outer_arm, path.ident.name.as_str(), recv, args, guard, &binding);
9999
}
100100
}
101101
}
102102

103103
fn check_method_calls<'tcx>(
104104
cx: &LateContext<'tcx>,
105105
arm: &Arm<'tcx>,
106-
method: Symbol,
106+
method: &str,
107107
recv: &Expr<'_>,
108108
args: &[Expr<'_>],
109109
if_expr: &Expr<'_>,
@@ -112,7 +112,7 @@ fn check_method_calls<'tcx>(
112112
let ty = cx.typeck_results().expr_ty(recv).peel_refs();
113113
let slice_like = ty.is_slice() || ty.is_array();
114114

115-
let sugg = if method == sym!(is_empty) {
115+
let sugg = if method == "is_empty" {
116116
// `s if s.is_empty()` becomes ""
117117
// `arr if arr.is_empty()` becomes []
118118

@@ -137,9 +137,9 @@ fn check_method_calls<'tcx>(
137137

138138
if needles.is_empty() {
139139
sugg.insert_str(1, "..");
140-
} else if method == sym!(starts_with) {
140+
} else if method == "starts_with" {
141141
sugg.insert_str(sugg.len() - 1, ", ..");
142-
} else if method == sym!(ends_with) {
142+
} else if method == "ends_with" {
143143
sugg.insert_str(1, ".., ");
144144
} else {
145145
return;

clippy_lints/src/methods/filter_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,12 +234,12 @@ impl<'tcx> OffendingFilterExpr<'tcx> {
234234
// the latter only calls `effect` once
235235
let side_effect_expr_span = receiver.can_have_side_effects().then_some(receiver.span);
236236

237-
if cx.tcx.is_diagnostic_item(sym::Option, recv_ty.did()) && path.ident.name == sym!(is_some) {
237+
if cx.tcx.is_diagnostic_item(sym::Option, recv_ty.did()) && path.ident.name.as_str() == "is_some" {
238238
Some(Self::IsSome {
239239
receiver,
240240
side_effect_expr_span,
241241
})
242-
} else if cx.tcx.is_diagnostic_item(sym::Result, recv_ty.did()) && path.ident.name == sym!(is_ok) {
242+
} else if cx.tcx.is_diagnostic_item(sym::Result, recv_ty.did()) && path.ident.name.as_str() == "is_ok" {
243243
Some(Self::IsOk {
244244
receiver,
245245
side_effect_expr_span,

clippy_lints/src/methods/needless_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ impl<'tcx> Visitor<'tcx> for IterFunctionVisitor<'_, 'tcx> {
322322
// Check function calls on our collection
323323
if let ExprKind::MethodCall(method_name, recv, args, _) = &expr.kind {
324324
if args.is_empty()
325-
&& method_name.ident.name == sym!(collect)
325+
&& method_name.ident.name.as_str() == "collect"
326326
&& is_trait_method(self.cx, expr, sym::Iterator)
327327
{
328328
self.current_mutably_captured_ids = get_captured_ids(self.cx, self.cx.typeck_results().expr_ty(recv));

clippy_lints/src/methods/read_line_without_trim.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ pub fn check(cx: &LateContext<'_>, call: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<
4444
if let Some(parent) = get_parent_expr(cx, expr) {
4545
let data = if let ExprKind::MethodCall(segment, recv, args, span) = parent.kind {
4646
if args.is_empty()
47-
&& segment.ident.name == sym!(parse)
47+
&& segment.ident.name.as_str() == "parse"
4848
&& let parse_result_ty = cx.typeck_results().expr_ty(parent)
4949
&& is_type_diagnostic_item(cx, parse_result_ty, sym::Result)
5050
&& let ty::Adt(_, substs) = parse_result_ty.kind()
@@ -58,7 +58,7 @@ pub fn check(cx: &LateContext<'_>, call: &Expr<'_>, recv: &Expr<'_>, arg: &Expr<
5858
"calling `.parse()` on a string without trimming the trailing newline character",
5959
"checking",
6060
))
61-
} else if segment.ident.name == sym!(ends_with)
61+
} else if segment.ident.name.as_str() == "ends_with"
6262
&& recv.span == expr.span
6363
&& let [arg] = args
6464
&& expr_is_string_literal_without_trailing_newline(arg)

clippy_lints/src/methods/unnecessary_filter_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn check_expression<'tcx>(cx: &LateContext<'tcx>, arg_id: hir::HirId, expr: &'tc
7878
(true, true)
7979
},
8080
hir::ExprKind::MethodCall(segment, recv, [arg], _) => {
81-
if segment.ident.name == sym!(then_some)
81+
if segment.ident.name.as_str() == "then_some"
8282
&& cx.typeck_results().expr_ty(recv).is_bool()
8383
&& path_to_local_id(arg, arg_id)
8484
{

clippy_lints/src/minmax.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ fn min_max<'a, 'tcx>(cx: &LateContext<'tcx>, expr: &'a Expr<'a>) -> Option<(MinM
7979
},
8080
ExprKind::MethodCall(path, receiver, args @ [_], _) => {
8181
if cx.typeck_results().expr_ty(receiver).is_floating_point() || is_trait_method(cx, expr, sym::Ord) {
82-
if path.ident.name == sym!(max) {
82+
if path.ident.name.as_str() == "max" {
8383
fetch_const(cx, Some(receiver), args, MinMax::Max)
84-
} else if path.ident.name == sym!(min) {
84+
} else if path.ident.name.as_str() == "min" {
8585
fetch_const(cx, Some(receiver), args, MinMax::Min)
8686
} else {
8787
None

clippy_lints/src/missing_fields_in_debug.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fn should_lint<'tcx>(
116116

117117
if path.ident.name == sym::debug_struct && is_type_diagnostic_item(cx, recv_ty, sym::Formatter) {
118118
has_debug_struct = true;
119-
} else if path.ident.name == sym!(finish_non_exhaustive)
119+
} else if path.ident.name.as_str() == "finish_non_exhaustive"
120120
&& is_type_diagnostic_item(cx, recv_ty, sym::DebugStruct)
121121
{
122122
has_finish_non_exhaustive = true;

clippy_lints/src/non_octal_unix_permissions.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ impl<'tcx> LateLintPass<'tcx> for NonOctalUnixPermissions {
4343
match &expr.kind {
4444
ExprKind::MethodCall(path, func, [param], _) => {
4545
if let Some(adt) = cx.typeck_results().expr_ty(func).peel_refs().ty_adt_def()
46-
&& ((path.ident.name == sym!(mode)
46+
&& ((path.ident.name.as_str() == "mode"
4747
&& matches!(
4848
cx.tcx.get_diagnostic_name(adt.did()),
4949
Some(sym::FsOpenOptions | sym::DirBuilder)
5050
))
51-
|| (path.ident.name == sym!(set_mode)
51+
|| (path.ident.name.as_str() == "set_mode"
5252
&& cx.tcx.is_diagnostic_item(sym::FsPermissions, adt.did())))
5353
&& let ExprKind::Lit(_) = param.kind
5454
&& param.span.eq_ctxt(expr.span)

clippy_lints/src/operators/float_cmp.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fn is_signum(cx: &LateContext<'_>, expr: &Expr<'_>) -> bool {
107107
}
108108

109109
if let ExprKind::MethodCall(method_name, self_arg, [], _) = expr.kind
110-
&& sym!(signum) == method_name.ident.name
110+
&& method_name.ident.name.as_str() == "signum"
111111
// Check that the receiver of the signum() is a float (expressions[0] is the receiver of
112112
// the method call)
113113
{

clippy_lints/src/ptr_offset_with_cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn expr_as_ptr_offset_call<'tcx>(
9696
if path_segment.ident.name == sym::offset {
9797
return Some((arg_0, arg_1, Method::Offset));
9898
}
99-
if path_segment.ident.name == sym!(wrapping_offset) {
99+
if path_segment.ident.name.as_str() == "wrapping_offset" {
100100
return Some((arg_0, arg_1, Method::WrappingOffset));
101101
}
102102
}

clippy_lints/src/question_mark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ fn is_early_return(smbl: Symbol, cx: &LateContext<'_>, if_block: &IfBlockType<'_
163163
is_type_diagnostic_item(cx, caller_ty, smbl)
164164
&& expr_return_none_or_err(smbl, cx, if_then, caller, None)
165165
&& match smbl {
166-
sym::Option => call_sym == sym!(is_none),
167-
sym::Result => call_sym == sym!(is_err),
166+
sym::Option => call_sym.as_str() == "is_none",
167+
sym::Result => call_sym.as_str() == "is_err",
168168
_ => false,
169169
}
170170
},

clippy_lints/src/slow_vector_initialization.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ impl<'tcx> VectorInitializationVisitor<'_, 'tcx> {
235235
if self.initialization_found
236236
&& let ExprKind::MethodCall(path, self_arg, [extend_arg], _) = expr.kind
237237
&& path_to_local_id(self_arg, self.vec_alloc.local_id)
238-
&& path.ident.name == sym!(extend)
238+
&& path.ident.name.as_str() == "extend"
239239
&& self.is_repeat_take(extend_arg)
240240
{
241241
self.slow_expression = Some(InitializationType::Extend(expr));
@@ -247,7 +247,7 @@ impl<'tcx> VectorInitializationVisitor<'_, 'tcx> {
247247
if self.initialization_found
248248
&& let ExprKind::MethodCall(path, self_arg, [len_arg, fill_arg], _) = expr.kind
249249
&& path_to_local_id(self_arg, self.vec_alloc.local_id)
250-
&& path.ident.name == sym!(resize)
250+
&& path.ident.name.as_str() == "resize"
251251
// Check that is filled with 0
252252
&& is_integer_literal(fill_arg, 0)
253253
{
@@ -269,7 +269,7 @@ impl<'tcx> VectorInitializationVisitor<'_, 'tcx> {
269269
/// Returns `true` if give expression is `repeat(0).take(...)`
270270
fn is_repeat_take(&mut self, expr: &'tcx Expr<'tcx>) -> bool {
271271
if let ExprKind::MethodCall(take_path, recv, [len_arg], _) = expr.kind
272-
&& take_path.ident.name == sym!(take)
272+
&& take_path.ident.name.as_str() == "take"
273273
// Check that take is applied to `repeat(0)`
274274
&& self.is_repeat_zero(recv)
275275
{

clippy_lints/src/strings.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
286286

287287
if !in_external_macro(cx.sess(), e.span)
288288
&& let ExprKind::MethodCall(path, receiver, ..) = &e.kind
289-
&& path.ident.name == sym!(as_bytes)
289+
&& path.ident.name.as_str() == "as_bytes"
290290
&& let ExprKind::Lit(lit) = &receiver.kind
291291
&& let LitKind::Str(lit_content, _) = &lit.node
292292
{
@@ -332,7 +332,7 @@ impl<'tcx> LateLintPass<'tcx> for StringLitAsBytes {
332332
}
333333

334334
if let ExprKind::MethodCall(path, recv, [], _) = &e.kind
335-
&& path.ident.name == sym!(into_bytes)
335+
&& path.ident.name.as_str() == "into_bytes"
336336
&& let ExprKind::MethodCall(path, recv, [], _) = &recv.kind
337337
&& matches!(path.ident.name.as_str(), "to_owned" | "to_string")
338338
&& let ExprKind::Lit(lit) = &recv.kind
@@ -493,7 +493,7 @@ impl<'tcx> LateLintPass<'tcx> for TrimSplitWhitespace {
493493
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &Expr<'_>) {
494494
let tyckres = cx.typeck_results();
495495
if let ExprKind::MethodCall(path, split_recv, [], split_ws_span) = expr.kind
496-
&& path.ident.name == sym!(split_whitespace)
496+
&& path.ident.name.as_str() == "split_whitespace"
497497
&& let Some(split_ws_def_id) = tyckres.type_dependent_def_id(expr.hir_id)
498498
&& cx.tcx.is_diagnostic_item(sym::str_split_whitespace, split_ws_def_id)
499499
&& let ExprKind::MethodCall(path, _trim_recv, [], trim_span) = split_recv.kind

clippy_lints/src/transmute/eager_transmute.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn binops_with_local(cx: &LateContext<'_>, local_expr: &Expr<'_>, expr: &Expr<'_
4343
binops_with_local(cx, local_expr, lhs) || binops_with_local(cx, local_expr, rhs)
4444
},
4545
ExprKind::MethodCall(path, receiver, [arg], _)
46-
if path.ident.name == sym!(contains)
46+
if path.ident.name.as_str() == "contains"
4747
// ... `contains` called on some kind of range
4848
&& let Some(receiver_adt) = cx.typeck_results().expr_ty(receiver).peel_refs().ty_adt_def()
4949
&& let lang_items = cx.tcx.lang_items()
@@ -81,7 +81,7 @@ pub(super) fn check<'tcx>(
8181
if let Some(then_some_call) = peel_parent_unsafe_blocks(cx, expr)
8282
&& let ExprKind::MethodCall(path, receiver, [arg], _) = then_some_call.kind
8383
&& cx.typeck_results().expr_ty(receiver).is_bool()
84-
&& path.ident.name == sym!(then_some)
84+
&& path.ident.name.as_str() == "then_some"
8585
&& is_local_with_projections(transmutable)
8686
&& binops_with_local(cx, transmutable, receiver)
8787
&& is_normalizable(cx, cx.param_env, from_ty)

clippy_lints/src/utils/internal_lints/lint_without_lint_pass.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,7 @@ pub(super) fn is_lint_ref_type(cx: &LateContext<'_>, ty: &hir::Ty<'_>) -> bool {
218218

219219
fn check_invalid_clippy_version_attribute(cx: &LateContext<'_>, item: &'_ Item<'_>) {
220220
if let Some(value) = extract_clippy_version_value(cx, item) {
221-
// The `sym!` macro doesn't work as it only expects a single token.
222-
// It's better to keep it this way and have a direct `Symbol::intern` call here.
223-
if value == Symbol::intern("pre 1.29.0") {
221+
if value.as_str() == "pre 1.29.0" {
224222
return;
225223
}
226224

clippy_lints/src/utils/internal_lints/msrv_attr_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl LateLintPass<'_> for MsrvAttrImpl {
4242
.filter(|t| matches!(t.unpack(), GenericArgKind::Type(_)))
4343
.any(|t| match_type(cx, t.expect_ty(), &paths::MSRV))
4444
})
45-
&& !items.iter().any(|item| item.ident.name == sym!(check_attributes))
45+
&& !items.iter().any(|item| item.ident.name.as_str() == "check_attributes")
4646
{
4747
let context = if is_late_pass { "LateContext" } else { "EarlyContext" };
4848
let lint_pass = if is_late_pass { "LateLintPass" } else { "EarlyLintPass" };

tests/ui-internal/unnecessary_symbol_str.fixed

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![feature(rustc_private)]
22
#![deny(clippy::internal)]
33
#![allow(
4+
clippy::slow_symbol_comparisons,
45
clippy::borrow_deref_ref,
56
clippy::unnecessary_operation,
67
unused_must_use,

0 commit comments

Comments
 (0)