Skip to content

Commit

Permalink
Remove redundant clone
Browse files Browse the repository at this point in the history
  • Loading branch information
sinkuu committed Oct 23, 2018
1 parent d570b36 commit fda3326
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/print.rs
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ich/caching_codemap_view.rs
Expand Up @@ -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,
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/traits/project.rs
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/sty.rs
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/hair/pattern/_match.rs
Expand Up @@ -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");
Expand Down Expand Up @@ -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| {
Expand Down
2 changes: 1 addition & 1 deletion src/libsyntax/fold.rs
Expand Up @@ -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)),
),
Expand Down

0 comments on commit fda3326

Please sign in to comment.