cleanup: don't clone types that are Copy
This commit is contained in:
parent
9903b256a2
commit
71cd918dc7
@ -217,7 +217,7 @@ pub fn early_report_macro_deprecation(
|
|||||||
suggestion_span: span,
|
suggestion_span: span,
|
||||||
note: depr.note,
|
note: depr.note,
|
||||||
path,
|
path,
|
||||||
since_kind: deprecated_since_kind(is_in_effect, depr.since.clone()),
|
since_kind: deprecated_since_kind(is_in_effect, depr.since),
|
||||||
};
|
};
|
||||||
lint_buffer.buffer_lint(deprecation_lint(is_in_effect), node_id, span, diag);
|
lint_buffer.buffer_lint(deprecation_lint(is_in_effect), node_id, span, diag);
|
||||||
}
|
}
|
||||||
|
@ -223,14 +223,14 @@ pub(crate) fn coroutine_by_move_body_def_id<'tcx>(
|
|||||||
|
|
||||||
// Inherited from the by-ref coroutine.
|
// Inherited from the by-ref coroutine.
|
||||||
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
|
body_def.codegen_fn_attrs(tcx.codegen_fn_attrs(coroutine_def_id).clone());
|
||||||
body_def.constness(tcx.constness(coroutine_def_id).clone());
|
body_def.constness(tcx.constness(coroutine_def_id));
|
||||||
body_def.coroutine_kind(tcx.coroutine_kind(coroutine_def_id).clone());
|
body_def.coroutine_kind(tcx.coroutine_kind(coroutine_def_id));
|
||||||
body_def.def_ident_span(tcx.def_ident_span(coroutine_def_id));
|
body_def.def_ident_span(tcx.def_ident_span(coroutine_def_id));
|
||||||
body_def.def_span(tcx.def_span(coroutine_def_id));
|
body_def.def_span(tcx.def_span(coroutine_def_id));
|
||||||
body_def.explicit_predicates_of(tcx.explicit_predicates_of(coroutine_def_id).clone());
|
body_def.explicit_predicates_of(tcx.explicit_predicates_of(coroutine_def_id));
|
||||||
body_def.generics_of(tcx.generics_of(coroutine_def_id).clone());
|
body_def.generics_of(tcx.generics_of(coroutine_def_id).clone());
|
||||||
body_def.param_env(tcx.param_env(coroutine_def_id).clone());
|
body_def.param_env(tcx.param_env(coroutine_def_id));
|
||||||
body_def.predicates_of(tcx.predicates_of(coroutine_def_id).clone());
|
body_def.predicates_of(tcx.predicates_of(coroutine_def_id));
|
||||||
|
|
||||||
// The type of the coroutine is the `by_move_coroutine_ty`.
|
// The type of the coroutine is the `by_move_coroutine_ty`.
|
||||||
body_def.type_of(ty::EarlyBinder::bind(by_move_coroutine_ty));
|
body_def.type_of(ty::EarlyBinder::bind(by_move_coroutine_ty));
|
||||||
|
@ -185,15 +185,14 @@ fn visit_var_debug_info(&mut self, var_debug_info: &mut VarDebugInfo<'tcx>) {
|
|||||||
&& let Some(local) = place.as_local()
|
&& let Some(local) = place.as_local()
|
||||||
&& local == self.local
|
&& local == self.local
|
||||||
{
|
{
|
||||||
let const_op = self
|
let const_op = *self
|
||||||
.operand
|
.operand
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| {
|
||||||
bug!("the operand was already stolen");
|
bug!("the operand was already stolen");
|
||||||
})
|
})
|
||||||
.constant()
|
.constant()
|
||||||
.unwrap()
|
.unwrap();
|
||||||
.clone();
|
|
||||||
var_debug_info.value = VarDebugInfoContents::Const(const_op);
|
var_debug_info.value = VarDebugInfoContents::Const(const_op);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -735,10 +735,10 @@ fn clone(&self) -> Self {
|
|||||||
Constructor::UnionField => Constructor::UnionField,
|
Constructor::UnionField => Constructor::UnionField,
|
||||||
Constructor::Bool(b) => Constructor::Bool(*b),
|
Constructor::Bool(b) => Constructor::Bool(*b),
|
||||||
Constructor::IntRange(range) => Constructor::IntRange(*range),
|
Constructor::IntRange(range) => Constructor::IntRange(*range),
|
||||||
Constructor::F16Range(lo, hi, end) => Constructor::F16Range(lo.clone(), *hi, *end),
|
Constructor::F16Range(lo, hi, end) => Constructor::F16Range(*lo, *hi, *end),
|
||||||
Constructor::F32Range(lo, hi, end) => Constructor::F32Range(lo.clone(), *hi, *end),
|
Constructor::F32Range(lo, hi, end) => Constructor::F32Range(*lo, *hi, *end),
|
||||||
Constructor::F64Range(lo, hi, end) => Constructor::F64Range(lo.clone(), *hi, *end),
|
Constructor::F64Range(lo, hi, end) => Constructor::F64Range(*lo, *hi, *end),
|
||||||
Constructor::F128Range(lo, hi, end) => Constructor::F128Range(lo.clone(), *hi, *end),
|
Constructor::F128Range(lo, hi, end) => Constructor::F128Range(*lo, *hi, *end),
|
||||||
Constructor::Str(value) => Constructor::Str(value.clone()),
|
Constructor::Str(value) => Constructor::Str(value.clone()),
|
||||||
Constructor::Opaque(inner) => Constructor::Opaque(inner.clone()),
|
Constructor::Opaque(inner) => Constructor::Opaque(inner.clone()),
|
||||||
Constructor::Or => Constructor::Or,
|
Constructor::Or => Constructor::Or,
|
||||||
|
@ -1469,11 +1469,7 @@ pub(crate) fn unresolved_macro_suggestions(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let unused_macro = self.unused_macros.iter().find_map(|(def_id, (_, unused_ident))| {
|
let unused_macro = self.unused_macros.iter().find_map(|(def_id, (_, unused_ident))| {
|
||||||
if unused_ident.name == ident.name {
|
if unused_ident.name == ident.name { Some((def_id, unused_ident)) } else { None }
|
||||||
Some((def_id.clone(), unused_ident.clone()))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if let Some((def_id, unused_ident)) = unused_macro {
|
if let Some((def_id, unused_ident)) = unused_macro {
|
||||||
|
Loading…
Reference in New Issue
Block a user