Rollup merge of #55282 - sinkuu:redundant_clone, r=estebank
Remove redundant clone
This commit is contained in:
commit
555df0f44f
@ -180,7 +180,7 @@ impl<'a> State<'a> {
|
||||
State {
|
||||
s: pp::mk_printer(out, default_columns),
|
||||
cm: Some(cm),
|
||||
comments: comments.clone(),
|
||||
comments,
|
||||
literals: literals.unwrap_or_default().into_iter().peekable(),
|
||||
cur_cmnt: 0,
|
||||
boxes: Vec::new(),
|
||||
|
@ -44,7 +44,7 @@ impl<'cm> CachingSourceMapView<'cm> {
|
||||
|
||||
CachingSourceMapView {
|
||||
source_map,
|
||||
line_cache: [entry.clone(), entry.clone(), entry.clone()],
|
||||
line_cache: [entry.clone(), entry.clone(), entry],
|
||||
time_stamp: 0,
|
||||
}
|
||||
}
|
||||
|
@ -340,7 +340,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
|
||||
let value = self.selcx.infcx().resolve_type_vars_if_possible(value);
|
||||
|
||||
if !value.has_projections() {
|
||||
value.clone()
|
||||
value
|
||||
} else {
|
||||
value.fold_with(self)
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ impl<'tcx> PolyFnSig<'tcx> {
|
||||
self.map_bound_ref(|fn_sig| fn_sig.inputs_and_output)
|
||||
}
|
||||
pub fn output(&self) -> ty::Binder<Ty<'tcx>> {
|
||||
self.map_bound_ref(|fn_sig| fn_sig.output().clone())
|
||||
self.map_bound_ref(|fn_sig| fn_sig.output())
|
||||
}
|
||||
pub fn variadic(&self) -> bool {
|
||||
self.skip_binder().variadic
|
||||
|
@ -1048,7 +1048,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
if let Some(constructors) = pat_constructors(cx, v[0], pcx) {
|
||||
debug!("is_useful - expanding constructors: {:#?}", constructors);
|
||||
split_grouped_constructors(cx.tcx, constructors, matrix, pcx.ty).into_iter().map(|c|
|
||||
is_useful_specialized(cx, matrix, v, c.clone(), pcx.ty, witness)
|
||||
is_useful_specialized(cx, matrix, v, c, pcx.ty, witness)
|
||||
).find(|result| result.is_useful()).unwrap_or(NotUseful)
|
||||
} else {
|
||||
debug!("is_useful - expanding wildcard");
|
||||
@ -1096,7 +1096,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
|
||||
|
||||
if missing_ctors.is_empty() && !is_non_exhaustive {
|
||||
split_grouped_constructors(cx.tcx, all_ctors, matrix, pcx.ty).into_iter().map(|c| {
|
||||
is_useful_specialized(cx, matrix, v, c.clone(), pcx.ty, witness)
|
||||
is_useful_specialized(cx, matrix, v, c, pcx.ty, witness)
|
||||
}).find(|result| result.is_useful()).unwrap_or(NotUseful)
|
||||
} else {
|
||||
let matrix = rows.iter().filter_map(|r| {
|
||||
|
@ -965,7 +965,7 @@ pub fn noop_fold_item_kind<T: Folder>(i: ItemKind, folder: &mut T) -> ItemKind {
|
||||
polarity,
|
||||
defaultness,
|
||||
folder.fold_generics(generics),
|
||||
ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref.clone())),
|
||||
ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref)),
|
||||
folder.fold_ty(ty),
|
||||
impl_items.move_flat_map(|item| folder.fold_impl_item(item)),
|
||||
),
|
||||
|
Loading…
x
Reference in New Issue
Block a user