remove unnecessary uses of clone

This commit is contained in:
Takayuki Maeda 2022-12-13 02:06:24 +09:00
parent f34356eace
commit ee40a67cd9
7 changed files with 7 additions and 7 deletions

View file

@ -114,7 +114,7 @@ impl Lit {
if let NtExpr(expr) | NtLiteral(expr) = &**nt
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
{
Some(token_lit.clone())
Some(token_lit)
}
_ => None,
}

View file

@ -630,7 +630,7 @@ fn check_incompatible_features(sess: &Session) {
{
let spans = vec![f1_span, f2_span];
sess.struct_span_err(
spans.clone(),
spans,
&format!(
"features `{}` and `{}` are incompatible, using them at the same time \
is not allowed",

View file

@ -745,7 +745,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
err.span_suggestion_verbose(
span.shrink_to_hi(),
"consider cloning the value if the performance cost is acceptable",
".clone()".to_string(),
".clone()",
Applicability::MachineApplicable,
);
}

View file

@ -32,7 +32,7 @@ pub fn expand(
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
} else {
ecx.sess.parse_sess.span_diagnostic.span_err(item.span(), "alloc_error_handler must be a function");
return vec![orig_item.clone()];
return vec![orig_item];
};
// Generate a bunch of new items using the AllocFnFactory

View file

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

View file

@ -206,7 +206,7 @@ pub(crate) fn run_thin(
}
pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBuffer) {
let name = module.name.clone();
let name = module.name;
let buffer = ThinBuffer::new(module.module_llvm.llmod(), true);
(name, buffer)
}

View file

@ -330,7 +330,7 @@ pub fn suggest_new_region_bound(
Applicability::MaybeIncorrect,
);
}
if let Some((param_span, param_ty)) = param.clone() {
if let Some((param_span, ref param_ty)) = param {
err.span_suggestion_verbose(
param_span,
add_static_bound,