Rollup merge of #105620 - TaKO8Ki:remove-unnecessary-uses-of-clone, r=compiler-errors
Remove unnecessary uses of `clone`
This commit is contained in:
commit
4069792d73
@ -114,7 +114,7 @@ pub fn from_token(token: &Token) -> Option<Lit> {
|
||||
if let NtExpr(expr) | NtLiteral(expr) = &**nt
|
||||
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
|
||||
{
|
||||
Some(token_lit.clone())
|
||||
Some(token_lit)
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
@ -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",
|
||||
|
@ -745,7 +745,7 @@ fn suggest_cloning(&self, err: &mut Diagnostic, ty: Ty<'tcx>, span: Span) {
|
||||
err.span_suggestion_verbose(
|
||||
span.shrink_to_hi(),
|
||||
"consider cloning the value if the performance cost is acceptable",
|
||||
".clone()".to_string(),
|
||||
".clone()",
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
|
@ -210,7 +210,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)
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user