Skip to content

Commit ee40a67

Browse files
committed
remove unnecessary uses of clone
1 parent f34356e commit ee40a67

File tree

7 files changed

+7
-7
lines changed

7 files changed

+7
-7
lines changed

compiler/rustc_ast/src/token.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl Lit {
114114
if let NtExpr(expr) | NtLiteral(expr) = &**nt
115115
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
116116
{
117-
Some(token_lit.clone())
117+
Some(token_lit)
118118
}
119119
_ => None,
120120
}

compiler/rustc_ast_passes/src/feature_gate.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ fn check_incompatible_features(sess: &Session) {
630630
{
631631
let spans = vec![f1_span, f2_span];
632632
sess.struct_span_err(
633-
spans.clone(),
633+
spans,
634634
&format!(
635635
"features `{}` and `{}` are incompatible, using them at the same time \
636636
is not allowed",

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
745745
err.span_suggestion_verbose(
746746
span.shrink_to_hi(),
747747
"consider cloning the value if the performance cost is acceptable",
748-
".clone()".to_string(),
748+
".clone()",
749749
Applicability::MachineApplicable,
750750
);
751751
}

compiler/rustc_builtin_macros/src/alloc_error_handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn expand(
3232
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
3333
} else {
3434
ecx.sess.parse_sess.span_diagnostic.span_err(item.span(), "alloc_error_handler must be a function");
35-
return vec![orig_item.clone()];
35+
return vec![orig_item];
3636
};
3737

3838
// Generate a bunch of new items using the AllocFnFactory

compiler/rustc_builtin_macros/src/concat_bytes.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub fn expand_concat_bytes(
196196
}
197197
}
198198
if !missing_literals.is_empty() {
199-
let mut err = cx.struct_span_err(missing_literals.clone(), "expected a byte literal");
199+
let mut err = cx.struct_span_err(missing_literals, "expected a byte literal");
200200
err.note("only byte literals (like `b\"foo\"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()`");
201201
err.emit();
202202
return base::MacEager::expr(DummyResult::raw_expr(sp, true));

compiler/rustc_codegen_llvm/src/back/lto.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ pub(crate) fn run_thin(
206206
}
207207

208208
pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBuffer) {
209-
let name = module.name.clone();
209+
let name = module.name;
210210
let buffer = ThinBuffer::new(module.module_llvm.llmod(), true);
211211
(name, buffer)
212212
}

compiler/rustc_infer/src/infer/error_reporting/nice_region_error/static_impl_trait.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ pub fn suggest_new_region_bound(
330330
Applicability::MaybeIncorrect,
331331
);
332332
}
333-
if let Some((param_span, param_ty)) = param.clone() {
333+
if let Some((param_span, ref param_ty)) = param {
334334
err.span_suggestion_verbose(
335335
param_span,
336336
add_static_bound,

0 commit comments

Comments
 (0)