Skip to content

Commit 070dcf8

Browse files
authored
Rollup merge of rust-lang#55282 - sinkuu:redundant_clone, r=estebank
Remove redundant clone
2 parents 3096b4a + fda3326 commit 070dcf8

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

src/librustc/hir/print.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ impl<'a> State<'a> {
180180
State {
181181
s: pp::mk_printer(out, default_columns),
182182
cm: Some(cm),
183-
comments: comments.clone(),
183+
comments,
184184
literals: literals.unwrap_or_default().into_iter().peekable(),
185185
cur_cmnt: 0,
186186
boxes: Vec::new(),

src/librustc/ich/caching_codemap_view.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'cm> CachingSourceMapView<'cm> {
4444

4545
CachingSourceMapView {
4646
source_map,
47-
line_cache: [entry.clone(), entry.clone(), entry.clone()],
47+
line_cache: [entry.clone(), entry.clone(), entry],
4848
time_stamp: 0,
4949
}
5050
}

src/librustc/traits/project.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ impl<'a, 'b, 'gcx, 'tcx> AssociatedTypeNormalizer<'a, 'b, 'gcx, 'tcx> {
340340
let value = self.selcx.infcx().resolve_type_vars_if_possible(value);
341341

342342
if !value.has_projections() {
343-
value.clone()
343+
value
344344
} else {
345345
value.fold_with(self)
346346
}

src/librustc/ty/sty.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ impl<'tcx> PolyFnSig<'tcx> {
967967
self.map_bound_ref(|fn_sig| fn_sig.inputs_and_output)
968968
}
969969
pub fn output(&self) -> ty::Binder<Ty<'tcx>> {
970-
self.map_bound_ref(|fn_sig| fn_sig.output().clone())
970+
self.map_bound_ref(|fn_sig| fn_sig.output())
971971
}
972972
pub fn variadic(&self) -> bool {
973973
self.skip_binder().variadic

src/librustc_mir/hair/pattern/_match.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,7 +1048,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
10481048
if let Some(constructors) = pat_constructors(cx, v[0], pcx) {
10491049
debug!("is_useful - expanding constructors: {:#?}", constructors);
10501050
split_grouped_constructors(cx.tcx, constructors, matrix, pcx.ty).into_iter().map(|c|
1051-
is_useful_specialized(cx, matrix, v, c.clone(), pcx.ty, witness)
1051+
is_useful_specialized(cx, matrix, v, c, pcx.ty, witness)
10521052
).find(|result| result.is_useful()).unwrap_or(NotUseful)
10531053
} else {
10541054
debug!("is_useful - expanding wildcard");
@@ -1096,7 +1096,7 @@ pub fn is_useful<'p, 'a: 'p, 'tcx: 'a>(cx: &mut MatchCheckCtxt<'a, 'tcx>,
10961096

10971097
if missing_ctors.is_empty() && !is_non_exhaustive {
10981098
split_grouped_constructors(cx.tcx, all_ctors, matrix, pcx.ty).into_iter().map(|c| {
1099-
is_useful_specialized(cx, matrix, v, c.clone(), pcx.ty, witness)
1099+
is_useful_specialized(cx, matrix, v, c, pcx.ty, witness)
11001100
}).find(|result| result.is_useful()).unwrap_or(NotUseful)
11011101
} else {
11021102
let matrix = rows.iter().filter_map(|r| {

src/libsyntax/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,7 @@ pub fn noop_fold_item_kind<T: Folder>(i: ItemKind, folder: &mut T) -> ItemKind {
965965
polarity,
966966
defaultness,
967967
folder.fold_generics(generics),
968-
ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref.clone())),
968+
ifce.map(|trait_ref| folder.fold_trait_ref(trait_ref)),
969969
folder.fold_ty(ty),
970970
impl_items.move_flat_map(|item| folder.fold_impl_item(item)),
971971
),

0 commit comments

Comments
 (0)