Skip to content

Commit a78c7fd

Browse files
committed
Remove redundant to_strings
1 parent 099ddba commit a78c7fd

7 files changed

+12
-12
lines changed

clippy_dev/src/update_lints.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,8 @@ mod tests {
619619
Lint::new("should_assert_eq2", "group2", "abc", None, "module_name"),
620620
];
621621
let expected = vec![
622-
format!("[`should_assert_eq`]: {}#should_assert_eq", DOCS_LINK.to_string()),
623-
format!("[`should_assert_eq2`]: {}#should_assert_eq2", DOCS_LINK.to_string()),
622+
format!("[`should_assert_eq`]: {}#should_assert_eq", DOCS_LINK),
623+
format!("[`should_assert_eq2`]: {}#should_assert_eq2", DOCS_LINK),
624624
];
625625
assert_eq!(expected, gen_changelog_lint_list(lints.iter()));
626626
}

clippy_lints/src/if_then_panic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ impl LateLintPass<'_> for IfThenPanic {
7878
if let Expr{kind: ExprKind::Unary(UnOp::Not, not_expr), ..} = e {
7979
sugg::Sugg::hir_with_applicability(cx, not_expr, "..", &mut applicability).maybe_par().to_string()
8080
} else {
81-
format!("!{}", sugg::Sugg::hir_with_applicability(cx, e, "..", &mut applicability).maybe_par().to_string())
81+
format!("!{}", sugg::Sugg::hir_with_applicability(cx, e, "..", &mut applicability).maybe_par())
8282
}
8383
} else {
84-
format!("!{}", sugg::Sugg::hir_with_applicability(cx, cond, "..", &mut applicability).maybe_par().to_string())
84+
format!("!{}", sugg::Sugg::hir_with_applicability(cx, cond, "..", &mut applicability).maybe_par())
8585
};
8686

8787
span_lint_and_sugg(

clippy_lints/src/inherent_to_string.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ fn show_lint(cx: &LateContext<'_>, item: &ImplItem<'_>) {
138138
item.span,
139139
&format!(
140140
"type `{}` implements inherent method `to_string(&self) -> String` which shadows the implementation of `Display`",
141-
self_type.to_string()
141+
self_type
142142
),
143143
None,
144-
&format!("remove the inherent method from type `{}`", self_type.to_string()),
144+
&format!("remove the inherent method from type `{}`", self_type),
145145
);
146146
} else {
147147
span_lint_and_help(
@@ -150,10 +150,10 @@ fn show_lint(cx: &LateContext<'_>, item: &ImplItem<'_>) {
150150
item.span,
151151
&format!(
152152
"implementation of inherent method `to_string(&self) -> String` for type `{}`",
153-
self_type.to_string()
153+
self_type
154154
),
155155
None,
156-
&format!("implement trait `Display` for type `{}` instead", self_type.to_string()),
156+
&format!("implement trait `Display` for type `{}` instead", self_type),
157157
);
158158
}
159159
}

clippy_lints/src/suspicious_operation_groupings.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ fn suggestion_with_swapped_ident(
678678
Some(format!(
679679
"{}{}{}",
680680
snippet_with_applicability(cx, expr.span.with_hi(current_ident.span.lo()), "..", applicability),
681-
new_ident.to_string(),
681+
new_ident,
682682
snippet_with_applicability(cx, expr.span.with_lo(current_ident.span.hi()), "..", applicability),
683683
))
684684
})

clippy_lints/src/transmute/transmute_int_to_char.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ pub(super) fn check<'tcx>(
3333
diag.span_suggestion(
3434
e.span,
3535
"consider using",
36-
format!("std::char::from_u32({}).unwrap()", arg.to_string()),
36+
format!("std::char::from_u32({}).unwrap()", arg),
3737
Applicability::Unspecified,
3838
);
3939
},

clippy_lints/src/transmute/transmute_int_to_float.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pub(super) fn check<'tcx>(
3636
diag.span_suggestion(
3737
e.span,
3838
"consider using",
39-
format!("{}::from_bits({})", to_ty, arg.to_string()),
39+
format!("{}::from_bits({})", to_ty, arg),
4040
Applicability::Unspecified,
4141
);
4242
},

clippy_lints/src/transmute/transmute_num_to_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(super) fn check<'tcx>(
3737
diag.span_suggestion(
3838
e.span,
3939
"consider using `to_ne_bytes()`",
40-
format!("{}.to_ne_bytes()", arg.to_string()),
40+
format!("{}.to_ne_bytes()", arg),
4141
Applicability::Unspecified,
4242
);
4343
},

0 commit comments

Comments
 (0)