Skip to content

Commit ecd4919

Browse files
committed
Remove unnecessary sigils around Symbol::as_str() calls.
1 parent a89a063 commit ecd4919

24 files changed

+34
-34
lines changed

clippy_lints/src/attrs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ fn check_attrs(cx: &LateContext<'_>, span: Span, name: Symbol, attrs: &[Attribut
486486

487487
fn check_semver(cx: &LateContext<'_>, span: Span, lit: &Lit) {
488488
if let LitKind::Str(is, _) = lit.kind {
489-
if Version::parse(&is.as_str()).is_ok() {
489+
if Version::parse(is.as_str()).is_ok() {
490490
return;
491491
}
492492
}
@@ -619,7 +619,7 @@ fn check_mismatched_target_os(cx: &EarlyContext<'_>, attr: &Attribute) {
619619
MetaItemKind::Word => {
620620
if_chain! {
621621
if let Some(ident) = meta.ident();
622-
if let Some(os) = find_os(&*ident.name.as_str());
622+
if let Some(os) = find_os(ident.name.as_str());
623623
then {
624624
mismatched.push((os, ident.span));
625625
}

clippy_lints/src/booleans.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ fn simplify_not(cx: &LateContext<'_>, expr: &Expr<'_>) -> Option<String> {
272272
.copied()
273273
.flat_map(|(a, b)| vec![(a, b), (b, a)])
274274
.find(|&(a, _)| {
275-
let path: &str = &path.ident.name.as_str();
275+
let path: &str = path.ident.name.as_str();
276276
a == path
277277
})
278278
.and_then(|(_, neg_method)| Some(format!("{}.{}()", snippet_opt(cx, args[0].span)?, neg_method)))

clippy_lints/src/checked_conversions.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,8 @@ fn get_implementing_type<'a>(path: &QPath<'_>, candidates: &'a [&str], function:
321321
if let TyKind::Path(QPath::Resolved(None, tp)) = &ty.kind;
322322
if let [int] = &*tp.segments;
323323
then {
324-
let name = &int.ident.name.as_str();
325-
candidates.iter().find(|c| name == *c).copied()
324+
let name = int.ident.name.as_str();
325+
candidates.iter().find(|c| &name == *c).copied()
326326
} else {
327327
None
328328
}
@@ -335,8 +335,8 @@ fn int_ty_to_sym<'tcx>(path: &QPath<'_>) -> Option<&'tcx str> {
335335
if let QPath::Resolved(_, path) = *path;
336336
if let [ty] = &*path.segments;
337337
then {
338-
let name = &ty.ident.name.as_str();
339-
INTS.iter().find(|c| name == *c).copied()
338+
let name = ty.ident.name.as_str();
339+
INTS.iter().find(|c| &name == *c).copied()
340340
} else {
341341
None
342342
}

clippy_lints/src/doc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn check_attrs<'a>(cx: &LateContext<'_>, valid_idents: &FxHashSet<String>, attrs
437437

438438
for attr in attrs {
439439
if let AttrKind::DocComment(comment_kind, comment) = attr.kind {
440-
let (comment, current_spans) = strip_doc_comment_decoration(&comment.as_str(), comment_kind, attr.span);
440+
let (comment, current_spans) = strip_doc_comment_decoration(comment.as_str(), comment_kind, attr.span);
441441
spans.extend_from_slice(&current_spans);
442442
doc.push_str(&comment);
443443
} else if attr.has_name(sym::doc) {

clippy_lints/src/enum_variants.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ fn check_variant(
153153
);
154154
}
155155
}
156-
let first = &def.variants[0].ident.name.as_str();
156+
let first = def.variants[0].ident.name.as_str();
157157
let mut pre = &first[..str_utils::camel_case_until(&*first).byte_index];
158158
let mut post = &first[str_utils::camel_case_start(&*first).byte_index..];
159159
for var in def.variants {

clippy_lints/src/float_literal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatLiteral {
6868
if let LitKind::Float(sym, lit_float_ty) = lit.node;
6969
then {
7070
let sym_str = sym.as_str();
71-
let formatter = FloatFormat::new(&sym_str);
71+
let formatter = FloatFormat::new(sym_str);
7272
// Try to bail out if the float is for sure fine.
7373
// If its within the 2 decimal digits of being out of precision we
7474
// check if the parsed representation is the same as the string

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
696696
let recv_ty = cx.typeck_results().expr_ty(&args[0]);
697697

698698
if recv_ty.is_floating_point() {
699-
match &*path.ident.name.as_str() {
699+
match path.ident.name.as_str() {
700700
"ln" => check_ln1p(cx, expr, args),
701701
"log" => check_log_base(cx, expr, args),
702702
"powf" => check_powf(cx, expr, args),

clippy_lints/src/iter_not_returning_iterator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ declare_lint_pass!(IterNotReturningIterator => [ITER_NOT_RETURNING_ITERATOR]);
4242

4343
impl LateLintPass<'_> for IterNotReturningIterator {
4444
fn check_impl_item(&mut self, cx: &LateContext<'tcx>, impl_item: &'tcx ImplItem<'tcx>) {
45-
let name: &str = &impl_item.ident.name.as_str();
45+
let name = impl_item.ident.name.as_str();
4646
if_chain! {
4747
if let ImplItemKind::Fn(fn_sig, _) = &impl_item.kind;
4848
let ret_ty = return_ty(cx, impl_item.hir_id());

clippy_lints/src/loops/needless_collect.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn check_needless_collect_direct_usage<'tcx>(expr: &'tcx Expr<'_>, cx: &LateCont
3131
let ty = cx.typeck_results().expr_ty(&args[0]);
3232
let mut applicability = Applicability::MaybeIncorrect;
3333
let is_empty_sugg = "next().is_none()".to_string();
34-
let method_name = &*method.ident.name.as_str();
34+
let method_name = method.ident.name.as_str();
3535
let sugg = if is_type_diagnostic_item(cx, ty, sym::Vec) ||
3636
is_type_diagnostic_item(cx, ty, sym::VecDeque) ||
3737
is_type_diagnostic_item(cx, ty, sym::LinkedList) ||
@@ -210,7 +210,7 @@ impl<'tcx> Visitor<'tcx> for IterFunctionVisitor<'_, 'tcx> {
210210
if let Some(hir_id) = self.current_statement_hir_id {
211211
self.hir_id_uses_map.insert(hir_id, self.uses.len());
212212
}
213-
match &*method_name.ident.name.as_str() {
213+
match method_name.ident.name.as_str() {
214214
"into_iter" => self.uses.push(Some(IterFunction {
215215
func: IterFunctionKind::IntoIter,
216216
span: expr.span,

clippy_lints/src/matches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ fn check_wild_err_arm<'tcx>(cx: &LateContext<'tcx>, ex: &Expr<'tcx>, arms: &[Arm
966966
for pat in inner.iter() {
967967
if let PatKind::Binding(_, id, ident, None) = pat.kind {
968968
if ident.as_str().starts_with('_') && !is_local_used(cx, arm.body, id) {
969-
ident_bind_name = (&ident.name.as_str()).to_string();
969+
ident_bind_name = ident.name.as_str().to_string();
970970
matching_wild = true;
971971
}
972972
}

0 commit comments

Comments
 (0)