diff --git a/compiler/rustc_codegen_ssa/src/lib.rs b/compiler/rustc_codegen_ssa/src/lib.rs index bc93bd8b7bd..e27eac3f69b 100644 --- a/compiler/rustc_codegen_ssa/src/lib.rs +++ b/compiler/rustc_codegen_ssa/src/lib.rs @@ -116,7 +116,7 @@ pub struct NativeLib { impl From<&cstore::NativeLib> for NativeLib { fn from(lib: &cstore::NativeLib) -> Self { - NativeLib { kind: lib.kind.clone(), name: lib.name.clone(), cfg: lib.cfg.clone() } + NativeLib { kind: lib.kind, name: lib.name, cfg: lib.cfg.clone() } } } diff --git a/src/librustdoc/clean/auto_trait.rs b/src/librustdoc/clean/auto_trait.rs index 3ca02b61063..2a8b6a321f1 100644 --- a/src/librustdoc/clean/auto_trait.rs +++ b/src/librustdoc/clean/auto_trait.rs @@ -597,7 +597,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { ref mut bindings, .. } => { bindings.push(TypeBinding { - name: left_name.clone(), + name: left_name, kind: TypeBindingKind::Equality { ty: rhs }, }); } @@ -665,7 +665,7 @@ impl<'a, 'tcx> AutoTraitFinder<'a, 'tcx> { GenericParamDefKind::Type { ref mut default, ref mut bounds, .. } => { // We never want something like `impl`. default.take(); - let generic_ty = Type::Generic(param.name.clone()); + let generic_ty = Type::Generic(param.name); if !has_sized.contains(&generic_ty) { bounds.insert(0, GenericBound::maybe_sized(self.cx)); } diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index a2a0ad1844f..e56556b5af7 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -831,7 +831,7 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, ty::GenericPredicates<'tcx where_predicates.retain(|pred| match *pred { WP::BoundPredicate { ty: Generic(ref g), ref bounds } => { if bounds.iter().any(|b| b.is_sized_bound(cx)) { - sized_params.insert(g.clone()); + sized_params.insert(*g); false } else { true @@ -847,7 +847,7 @@ impl<'a, 'tcx> Clean for (&'a ty::Generics, ty::GenericPredicates<'tcx && !sized_params.contains(&tp.name) { where_predicates.push(WP::BoundPredicate { - ty: Type::Generic(tp.name.clone()), + ty: Type::Generic(tp.name), bounds: vec![GenericBound::maybe_sized(cx)], }) } diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 2e479d25203..2cde0c209ee 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -74,7 +74,7 @@ crate fn krate(mut cx: &mut DocContext<'_>) -> Crate { ) })); m.items.extend(keywords.into_iter().map(|(def_id, kw)| { - Item::from_def_id_and_parts(def_id, Some(kw.clone()), ItemKind::KeywordItem(kw), cx) + Item::from_def_id_and_parts(def_id, Some(kw), ItemKind::KeywordItem(kw), cx) })); } @@ -307,7 +307,7 @@ crate fn strip_path(path: &Path) -> Path { .segments .iter() .map(|s| PathSegment { - name: s.name.clone(), + name: s.name, args: GenericArgs::AngleBracketed { args: vec![], bindings: vec![] }, }) .collect(); diff --git a/src/librustdoc/html/render/mod.rs b/src/librustdoc/html/render/mod.rs index 6f8a4d9513b..407076ed6ff 100644 --- a/src/librustdoc/html/render/mod.rs +++ b/src/librustdoc/html/render/mod.rs @@ -538,7 +538,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> { fn after_krate(&mut self, krate: &clean::Crate, cache: &Cache) -> Result<(), Error> { let final_file = self.dst.join(&*krate.name.as_str()).join("all.html"); let settings_file = self.dst.join("settings.html"); - let crate_name = krate.name.clone(); + let crate_name = krate.name; let mut root_path = self.dst.to_str().expect("invalid path").to_owned(); if !root_path.ends_with('/') { @@ -3967,7 +3967,7 @@ fn render_impl( cache: &Cache, ) { for trait_item in &t.items { - let n = trait_item.name.clone(); + let n = trait_item.name; if i.items.iter().any(|m| m.name == n) { continue; } diff --git a/src/librustdoc/passes/collect_intra_doc_links.rs b/src/librustdoc/passes/collect_intra_doc_links.rs index 2d26e3b71ca..aa100363a38 100644 --- a/src/librustdoc/passes/collect_intra_doc_links.rs +++ b/src/librustdoc/passes/collect_intra_doc_links.rs @@ -1234,7 +1234,7 @@ impl LinkCollector<'_, '_> { ) -> Option<(Res, Option)> { // Try to look up both the result and the corresponding side channel value if let Some(ref cached) = self.visited_links.get(&key) { - self.kind_side_channel.set(cached.side_channel.clone()); + self.kind_side_channel.set(cached.side_channel); return Some(cached.res.clone()); }