Avoid some unnecessary cloning.
This commit is contained in:
parent
750f57fafe
commit
4f1f1a2b57
6 changed files with 11 additions and 12 deletions
|
|
@ -106,7 +106,7 @@ impl From<DefId> for ItemId {
|
|||
}
|
||||
|
||||
/// The crate currently being documented.
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub(crate) struct Crate {
|
||||
pub(crate) module: Item,
|
||||
/// Only here so that they can be filtered through the rustdoc passes.
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ use super::static_files::{STATIC_FILES, StaticFiles};
|
|||
use crate::externalfiles::ExternalHtml;
|
||||
use crate::html::render::{StylePath, ensure_trailing_slash};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub(crate) struct Layout {
|
||||
pub(crate) logo: String,
|
||||
pub(crate) favicon: String,
|
||||
|
|
|
|||
|
|
@ -195,7 +195,7 @@ fn slugify(c: char) -> Option<char> {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
#[derive(Debug)]
|
||||
pub struct Playground {
|
||||
pub crate_name: Option<Symbol>,
|
||||
pub url: String,
|
||||
|
|
|
|||
|
|
@ -2530,7 +2530,7 @@ fn item_ty_to_section(ty: ItemType) -> ItemSection {
|
|||
/// types are re-exported, we don't use the corresponding
|
||||
/// entry from the js file, as inlining will have already
|
||||
/// picked up the impl
|
||||
fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
|
||||
fn collect_paths_for_type(first_ty: &clean::Type, cache: &Cache) -> Vec<String> {
|
||||
let mut out = Vec::new();
|
||||
let mut visited = FxHashSet::default();
|
||||
let mut work = VecDeque::new();
|
||||
|
|
@ -2547,7 +2547,7 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
|
|||
work.push_back(first_ty);
|
||||
|
||||
while let Some(ty) = work.pop_front() {
|
||||
if !visited.insert(ty.clone()) {
|
||||
if !visited.insert(ty) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -2557,16 +2557,16 @@ fn collect_paths_for_type(first_ty: clean::Type, cache: &Cache) -> Vec<String> {
|
|||
work.extend(tys.into_iter());
|
||||
}
|
||||
clean::Type::Slice(ty) => {
|
||||
work.push_back(*ty);
|
||||
work.push_back(ty);
|
||||
}
|
||||
clean::Type::Array(ty, _) => {
|
||||
work.push_back(*ty);
|
||||
work.push_back(ty);
|
||||
}
|
||||
clean::Type::RawPointer(_, ty) => {
|
||||
work.push_back(*ty);
|
||||
work.push_back(ty);
|
||||
}
|
||||
clean::Type::BorrowedRef { type_, .. } => {
|
||||
work.push_back(*type_);
|
||||
work.push_back(type_);
|
||||
}
|
||||
clean::Type::QPath(box clean::QPathData { self_type, trait_, .. }) => {
|
||||
work.push_back(self_type);
|
||||
|
|
|
|||
|
|
@ -659,7 +659,7 @@ fn item_trait(cx: &Context<'_>, it: &clean::Item, t: &clean::Trait) -> impl fmt:
|
|||
let count_types = required_types.len() + provided_types.len();
|
||||
let count_consts = required_consts.len() + provided_consts.len();
|
||||
let count_methods = required_methods.len() + provided_methods.len();
|
||||
let must_implement_one_of_functions = tcx.trait_def(t.def_id).must_implement_one_of.clone();
|
||||
let must_implement_one_of_functions = &tcx.trait_def(t.def_id).must_implement_one_of;
|
||||
|
||||
// Output the trait definition
|
||||
wrap_item(w, |mut w| {
|
||||
|
|
@ -1095,7 +1095,7 @@ fn item_trait(cx: &Context<'_>, it: &clean::Item, t: &clean::Trait) -> impl fmt:
|
|||
it,
|
||||
&implementor_dups,
|
||||
&collect_paths_for_type(
|
||||
implementor.inner_impl().for_.clone(),
|
||||
&implementor.inner_impl().for_,
|
||||
&cx.shared.cache,
|
||||
),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -760,7 +760,7 @@ impl TraitAliasPart {
|
|||
Some(Implementor {
|
||||
text: imp.inner_impl().print(false, cx).to_string(),
|
||||
synthetic: imp.inner_impl().kind.is_auto(),
|
||||
types: collect_paths_for_type(imp.inner_impl().for_.clone(), cache),
|
||||
types: collect_paths_for_type(&imp.inner_impl().for_, cache),
|
||||
})
|
||||
}
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue