Skip to content

Commit eafa74a

Browse files
authored
Rollup merge of #121231 - matthiaskrgr:cloone, r=compiler-errors
remove a couple of redundant clones
2 parents 4ddc8e4 + 87b6f41 commit eafa74a

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

compiler/rustc_hir_typeck/src/_match.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
311311
error: &mut bool,
312312
) {
313313
if let Some((if_span, msg)) = ret_reason {
314-
err.span_label(if_span, msg.clone());
314+
err.span_label(if_span, msg);
315315
} else if let ExprKind::Block(block, _) = then_expr.kind
316316
&& let Some(expr) = block.expr
317317
{

compiler/rustc_parse/src/parser/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,6 @@ impl<'a> Parser<'a> {
452452
let mut expected = self
453453
.expected_tokens
454454
.iter()
455-
.cloned()
456455
.filter(|token| {
457456
// Filter out suggestions that suggest the same token which was found and deemed incorrect.
458457
fn is_ident_eq_keyword(found: &TokenKind, expected: &TokenType) -> bool {
@@ -464,7 +463,7 @@ impl<'a> Parser<'a> {
464463
false
465464
}
466465

467-
if *token != parser::TokenType::Token(self.token.kind.clone()) {
466+
if **token != parser::TokenType::Token(self.token.kind.clone()) {
468467
let eq = is_ident_eq_keyword(&self.token.kind, &token);
469468
// If the suggestion is a keyword and the found token is an ident,
470469
// the content of which are equal to the suggestion's content,
@@ -483,6 +482,7 @@ impl<'a> Parser<'a> {
483482
}
484483
false
485484
})
485+
.cloned()
486486
.collect::<Vec<_>>();
487487
expected.sort_by_cached_key(|x| x.to_string());
488488
expected.dedup();

compiler/rustc_parse_format/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ impl<'a> Parser<'a> {
893893
ParseError {
894894
description: "expected format parameter to occur after `:`".to_owned(),
895895
note: None,
896-
label: format!("expected `{}` to occur after `:`", alignment).to_owned(),
896+
label: format!("expected `{}` to occur after `:`", alignment),
897897
span: pos.to(pos),
898898
secondary_label: None,
899899
suggestion: Suggestion::None,

src/tools/clippy/clippy_utils/src/diagnostics.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ pub fn span_lint_and_help<T: LintContext>(
8484
cx.span_lint(lint, span, msg.to_string(), |diag| {
8585
let help = help.to_string();
8686
if let Some(help_span) = help_span {
87-
diag.span_help(help_span, help.to_string());
87+
diag.span_help(help_span, help);
8888
} else {
89-
diag.help(help.to_string());
89+
diag.help(help);
9090
}
9191
docs_link(diag, lint);
9292
});

0 commit comments

Comments
 (0)