Skip to content

Commit a83c935

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

16 files changed

+20
-20
lines changed

clippy_lints/src/duration_subsec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for DurationSubsec {
4949
if match_type(cx, cx.typeck_results().expr_ty(&args[0]).peel_refs(), &paths::DURATION);
5050
if let Some((Constant::Int(divisor), _)) = constant(cx, cx.typeck_results(), right);
5151
then {
52-
let suggested_fn = match (method_path.ident.as_str().as_ref(), divisor) {
52+
let suggested_fn = match (method_path.ident.as_str(), divisor) {
5353
("subsec_micros", 1_000) | ("subsec_nanos", 1_000_000) => "subsec_millis",
5454
("subsec_nanos", 1_000) => "subsec_micros",
5555
_ => return,

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ fn are_same_base_logs(cx: &LateContext<'_>, expr_a: &Expr<'_>, expr_b: &Expr<'_>
599599
return method_name_a.as_str() == method_name_b.as_str() &&
600600
args_a.len() == args_b.len() &&
601601
(
602-
["ln", "log2", "log10"].contains(&&*method_name_a.as_str()) ||
602+
["ln", "log2", "log10"].contains(&method_name_a.as_str()) ||
603603
method_name_a.as_str() == "log" && args_a.len() == 2 && eq_expr_value(cx, &args_a[1], &args_b[1])
604604
);
605605
}

clippy_lints/src/loops/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ fn check_for_loop_arg(cx: &LateContext<'_>, pat: &Pat<'_>, arg: &Expr<'_>) {
659659
let mut next_loop_linted = false; // whether or not ITER_NEXT_LOOP lint was used
660660

661661
if let ExprKind::MethodCall(method, _, [self_arg], _) = arg.kind {
662-
let method_name = &*method.ident.as_str();
662+
let method_name = method.ident.as_str();
663663
// check for looping over x.iter() or x.iter_mut(), could use &x or &mut x
664664
match method_name {
665665
"iter" | "iter_mut" => explicit_iter_loop::check(cx, self_arg, arg, method_name),

clippy_lints/src/match_str_case_mismatch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl<'a, 'tcx> Visitor<'tcx> for MatchExprVisitor<'a, 'tcx> {
9595
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
9696
match ex.kind {
9797
ExprKind::MethodCall(segment, _, [receiver], _)
98-
if self.case_altered(&*segment.ident.as_str(), receiver) => {},
98+
if self.case_altered(segment.ident.as_str(), receiver) => {},
9999
_ => walk_expr(self, ex),
100100
}
101101
}

clippy_lints/src/matches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ fn check_wild_enum_match(cx: &LateContext<'_>, ex: &Expr<'_>, arms: &[Arm<'_>])
11271127
if let CommonPrefixSearcher::Path(path_prefix) = path_prefix {
11281128
let mut s = String::new();
11291129
for seg in path_prefix {
1130-
s.push_str(&seg.ident.as_str());
1130+
s.push_str(seg.ident.as_str());
11311131
s.push_str("::");
11321132
}
11331133
s

clippy_lints/src/methods/manual_saturating_arithmetic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ fn is_min_or_max<'tcx>(cx: &LateContext<'tcx>, expr: &hir::Expr<'_>) -> Option<M
8181
if args.is_empty();
8282
if let hir::ExprKind::Path(hir::QPath::TypeRelative(_, segment)) = &func.kind;
8383
then {
84-
match &*segment.ident.as_str() {
84+
match segment.ident.as_str() {
8585
"max_value" => return Some(MinMax::Max),
8686
"min_value" => return Some(MinMax::Min),
8787
_ => {}

clippy_lints/src/methods/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1999,8 +1999,8 @@ impl<'tcx> LateLintPass<'tcx> for Methods {
19991999
from_iter_instead_of_collect::check(cx, expr, args, func);
20002000
},
20012001
hir::ExprKind::MethodCall(method_call, ref method_span, args, _) => {
2002-
or_fun_call::check(cx, expr, *method_span, &method_call.ident.as_str(), args);
2003-
expect_fun_call::check(cx, expr, *method_span, &method_call.ident.as_str(), args);
2002+
or_fun_call::check(cx, expr, *method_span, method_call.ident.as_str(), args);
2003+
expect_fun_call::check(cx, expr, *method_span, method_call.ident.as_str(), args);
20042004
clone_on_copy::check(cx, expr, method_call.ident.name, args);
20052005
clone_on_ref_ptr::check(cx, expr, method_call.ident.name, args);
20062006
inefficient_to_string::check(cx, expr, method_call.ident.name, args);

clippy_lints/src/methods/str_splitn.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ fn parse_iter_usage(
140140
let did = cx.typeck_results().type_dependent_def_id(e.hir_id)?;
141141
let iter_id = cx.tcx.get_diagnostic_item(sym::Iterator)?;
142142

143-
match (&*name.ident.as_str(), args) {
143+
match (name.ident.as_str(), args) {
144144
("next", []) if cx.tcx.trait_of_item(did) == Some(iter_id) => {
145145
if reverse {
146146
(IterUsageKind::Second, e.span)
@@ -298,7 +298,7 @@ fn check_iter(
298298
if let Some(did) = cx.typeck_results().type_dependent_def_id(e.hir_id);
299299
if let Some(iter_id) = cx.tcx.get_diagnostic_item(sym::Iterator);
300300
then {
301-
match (&*name.ident.as_str(), args) {
301+
match (name.ident.as_str(), args) {
302302
("next", []) if cx.tcx.trait_of_item(did) == Some(iter_id) => {
303303
return true;
304304
},

clippy_lints/src/mut_reference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl<'tcx> LateLintPass<'tcx> for UnnecessaryMutPassed {
4949
let def_id = cx.typeck_results().type_dependent_def_id(e.hir_id).unwrap();
5050
let substs = cx.typeck_results().node_substs(e.hir_id);
5151
let method_type = cx.tcx.type_of(def_id).subst(cx.tcx, substs);
52-
check_arguments(cx, arguments, method_type, &path.ident.as_str(), "method");
52+
check_arguments(cx, arguments, method_type, path.ident.as_str(), "method");
5353
},
5454
_ => (),
5555
}

clippy_lints/src/needless_option_as_deref.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ impl<'tcx> LateLintPass<'tcx> for OptionNeedlessDeref {
4848
if is_type_diagnostic_item(cx,outer_ty,sym::Option);
4949
if let ExprKind::MethodCall(path, _, [sub_expr], _) = expr.kind;
5050
let symbol = path.ident.as_str();
51-
if symbol=="as_deref" || symbol=="as_deref_mut";
51+
if symbol == "as_deref" || symbol == "as_deref_mut";
5252
if TyS::same_type( outer_ty, typeck.expr_ty(sub_expr) );
5353
then{
5454
span_lint_and_sugg(

0 commit comments

Comments
 (0)