diff options
| author | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-10-23 17:13:59 +0900 |
|---|---|---|
| committer | Shotaro Yamada <sinkuu@sinkuu.xyz> | 2018-10-23 17:13:59 +0900 |
| commit | fda3326a5a34fd365e20f0dd2632cec27233d060 (patch) | |
| tree | 88b647464c11fde81905b24f64cb41c1f6452d94 | |
| parent | d570b36cd9dd0a3c1b94e6fc4004ee5557140d31 (diff) | |
| download | rust-fda3326a5a34fd365e20f0dd2632cec27233d060.tar.gz rust-fda3326a5a34fd365e20f0dd2632cec27233d060.zip | |
Remove redundant clone
| -rw-r--r-- | src/librustc/hir/print.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ich/caching_codemap_view.rs | 2 | ||||
| -rw-r--r-- | src/librustc/traits/project.rs | 2 | ||||
| -rw-r--r-- | src/librustc/ty/sty.rs | 2 | ||||
| -rw-r--r-- | src/librustc_mir/hair/pattern/_match.rs | 4 | ||||
| -rw-r--r-- | src/libsyntax/fold.rs | 2 |
6 files changed, 7 insertions, 7 deletions
diff --git a/src/librustc/hir/print.rs b/src/librustc/hir/print.rs index 08d46793d97..ad2fa48610b 100644 --- a/src/librustc/hir/print.rs +++ b/src/librustc/hir/print.rs @@ -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(), diff --git a/src/librustc/ich/caching_codemap_view.rs b/src/librustc/ich/caching_codemap_view.rs index 97114779042..fbf4297222f 100644 --- a/src/librustc/ich/caching_codemap_view.rs +++ b/src/librustc/ich/caching_codemap_view.rs @@ -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, } } diff --git a/src/librustc/traits/project.rs b/src/librustc/traits/project.rs index b29ee8f7cdc..b266fbe0d11 100644 --- a/src/librustc/traits/project.rs +++ b/src/librustc/traits/project.rs @@ -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) } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index 82891583870..0acf711c238 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -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 diff --git a/src/librustc_mir/hair/pattern/_match.rs b/src/librustc_mir/hair/pattern/_match.rs index 04a297d0a83..77483ad184b 100644 --- a/src/librustc_mir/hair/pattern/_match.rs +++ b/src/librustc_mir/hair/pattern/_match.rs @@ -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| { diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index 95a2298ca75..18d5970462f 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -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)), ), |
