Switch to Symbol for item.name
This decreases the size of `Item` from 680 to 616 bytes. It also does a lot less work since it no longer has to copy as much.
This commit is contained in:
parent
89fc5034f4
commit
a16904fecf
10 changed files with 78 additions and 45 deletions
|
@ -1469,6 +1469,10 @@ impl Symbol {
|
||||||
self.0.as_u32()
|
self.0.as_u32()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_empty(self) -> bool {
|
||||||
|
self == kw::Invalid
|
||||||
|
}
|
||||||
|
|
||||||
/// This method is supposed to be used in error messages, so it's expected to be
|
/// This method is supposed to be used in error messages, so it's expected to be
|
||||||
/// identical to printing the original identifier token written in source code
|
/// identical to printing the original identifier token written in source code
|
||||||
/// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag
|
/// (`token_to_string`, `Ident::to_string`), except that symbols don't keep the rawness flag
|
||||||
|
|
|
@ -124,7 +124,7 @@ crate fn try_inline(
|
||||||
let attrs = merge_attrs(cx, Some(parent_module), target_attrs, attrs_clone);
|
let attrs = merge_attrs(cx, Some(parent_module), target_attrs, attrs_clone);
|
||||||
|
|
||||||
cx.renderinfo.borrow_mut().inlined.insert(did);
|
cx.renderinfo.borrow_mut().inlined.insert(did);
|
||||||
let what_rustc_thinks = clean::Item::from_def_id_and_parts(did, Some(name.clean(cx)), kind, cx);
|
let what_rustc_thinks = clean::Item::from_def_id_and_parts(did, Some(name), kind, cx);
|
||||||
ret.push(clean::Item { attrs, ..what_rustc_thinks });
|
ret.push(clean::Item { attrs, ..what_rustc_thinks });
|
||||||
Some(ret)
|
Some(ret)
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,7 +169,7 @@ impl Clean<ExternalCrate> for CrateNum {
|
||||||
for attr in attrs.lists(sym::doc) {
|
for attr in attrs.lists(sym::doc) {
|
||||||
if attr.has_name(sym::keyword) {
|
if attr.has_name(sym::keyword) {
|
||||||
if let Some(v) = attr.value_str() {
|
if let Some(v) = attr.value_str() {
|
||||||
keyword = Some(v.to_string());
|
keyword = Some(v);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,11 +253,7 @@ impl Clean<Item> for doctree::Module<'_> {
|
||||||
ModuleItem(Module { is_crate: self.is_crate, items }),
|
ModuleItem(Module { is_crate: self.is_crate, items }),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
Item {
|
Item { attrs, source: span.clean(cx), ..what_rustc_thinks }
|
||||||
attrs,
|
|
||||||
source: span.clean(cx),
|
|
||||||
..what_rustc_thinks
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1095,7 +1091,7 @@ impl Clean<Item> for hir::TraitItem<'_> {
|
||||||
AssocTypeItem(bounds.clean(cx), default.clean(cx))
|
AssocTypeItem(bounds.clean(cx), default.clean(cx))
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Item::from_def_id_and_parts(local_did, Some(self.ident.name.clean(cx)), inner, cx)
|
Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1123,7 +1119,7 @@ impl Clean<Item> for hir::ImplItem<'_> {
|
||||||
TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
|
TypedefItem(Typedef { type_, generics: Generics::default(), item_type }, true)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Item::from_def_id_and_parts(local_did, Some(self.ident.name.clean(cx)), inner, cx)
|
Item::from_def_id_and_parts(local_did, Some(self.ident.name), inner, cx)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1280,7 +1276,7 @@ impl Clean<Item> for ty::AssocItem {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Item::from_def_id_and_parts(self.def_id, Some(self.ident.name.clean(cx)), kind, cx)
|
Item::from_def_id_and_parts(self.def_id, Some(self.ident.name), kind, cx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1770,7 +1766,7 @@ impl Clean<Item> for ty::FieldDef {
|
||||||
fn clean(&self, cx: &DocContext<'_>) -> Item {
|
fn clean(&self, cx: &DocContext<'_>) -> Item {
|
||||||
let what_rustc_thinks = Item::from_def_id_and_parts(
|
let what_rustc_thinks = Item::from_def_id_and_parts(
|
||||||
self.did,
|
self.did,
|
||||||
Some(self.ident.name.clean(cx)),
|
Some(self.ident.name),
|
||||||
StructFieldItem(cx.tcx.type_of(self.did).clean(cx)),
|
StructFieldItem(cx.tcx.type_of(self.did).clean(cx)),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
@ -1846,7 +1842,7 @@ impl Clean<Item> for ty::VariantDef {
|
||||||
.fields
|
.fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|field| {
|
.map(|field| {
|
||||||
let name = Some(field.ident.name.clean(cx));
|
let name = Some(field.ident.name);
|
||||||
let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
|
let kind = StructFieldItem(cx.tcx.type_of(field.did).clean(cx));
|
||||||
let what_rustc_thinks =
|
let what_rustc_thinks =
|
||||||
Item::from_def_id_and_parts(field.did, name, kind, cx);
|
Item::from_def_id_and_parts(field.did, name, kind, cx);
|
||||||
|
@ -1858,7 +1854,7 @@ impl Clean<Item> for ty::VariantDef {
|
||||||
};
|
};
|
||||||
let what_rustc_thinks = Item::from_def_id_and_parts(
|
let what_rustc_thinks = Item::from_def_id_and_parts(
|
||||||
self.def_id,
|
self.def_id,
|
||||||
Some(self.ident.name.clean(cx)),
|
Some(self.ident.name),
|
||||||
VariantItem(Variant { kind }),
|
VariantItem(Variant { kind }),
|
||||||
cx,
|
cx,
|
||||||
);
|
);
|
||||||
|
@ -2032,7 +2028,7 @@ impl Clean<Vec<Item>> for (&hir::Item<'_>, Option<Symbol>) {
|
||||||
_ => unreachable!("not yet converted"),
|
_ => unreachable!("not yet converted"),
|
||||||
};
|
};
|
||||||
|
|
||||||
vec![Item::from_def_id_and_parts(def_id, Some(name.clean(cx)), kind, cx)]
|
vec![Item::from_def_id_and_parts(def_id, Some(name), kind, cx)]
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,7 +70,7 @@ crate struct ExternalCrate {
|
||||||
crate src: FileName,
|
crate src: FileName,
|
||||||
crate attrs: Attributes,
|
crate attrs: Attributes,
|
||||||
crate primitives: Vec<(DefId, PrimitiveType)>,
|
crate primitives: Vec<(DefId, PrimitiveType)>,
|
||||||
crate keywords: Vec<(DefId, String)>,
|
crate keywords: Vec<(DefId, Symbol)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Anything with a source location and set of attributes and, optionally, a
|
/// Anything with a source location and set of attributes and, optionally, a
|
||||||
|
@ -81,7 +81,7 @@ crate struct Item {
|
||||||
/// Stringified span
|
/// Stringified span
|
||||||
crate source: Span,
|
crate source: Span,
|
||||||
/// Not everything has a name. E.g., impls
|
/// Not everything has a name. E.g., impls
|
||||||
crate name: Option<String>,
|
crate name: Option<Symbol>,
|
||||||
crate attrs: Attributes,
|
crate attrs: Attributes,
|
||||||
crate visibility: Visibility,
|
crate visibility: Visibility,
|
||||||
crate kind: ItemKind,
|
crate kind: ItemKind,
|
||||||
|
@ -123,17 +123,12 @@ impl Item {
|
||||||
kind: ItemKind,
|
kind: ItemKind,
|
||||||
cx: &DocContext<'_>,
|
cx: &DocContext<'_>,
|
||||||
) -> Item {
|
) -> Item {
|
||||||
Item::from_def_id_and_parts(
|
Item::from_def_id_and_parts(cx.tcx.hir().local_def_id(hir_id).to_def_id(), name, kind, cx)
|
||||||
cx.tcx.hir().local_def_id(hir_id).to_def_id(),
|
|
||||||
name.clean(cx),
|
|
||||||
kind,
|
|
||||||
cx,
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_def_id_and_parts(
|
pub fn from_def_id_and_parts(
|
||||||
def_id: DefId,
|
def_id: DefId,
|
||||||
name: Option<String>,
|
name: Option<Symbol>,
|
||||||
kind: ItemKind,
|
kind: ItemKind,
|
||||||
cx: &DocContext<'_>,
|
cx: &DocContext<'_>,
|
||||||
) -> Item {
|
) -> Item {
|
||||||
|
@ -334,7 +329,7 @@ crate enum ItemKind {
|
||||||
AssocTypeItem(Vec<GenericBound>, Option<Type>),
|
AssocTypeItem(Vec<GenericBound>, Option<Type>),
|
||||||
/// An item that has been stripped by a rustdoc pass
|
/// An item that has been stripped by a rustdoc pass
|
||||||
StrippedItem(Box<ItemKind>),
|
StrippedItem(Box<ItemKind>),
|
||||||
KeywordItem(String),
|
KeywordItem(Symbol),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ItemKind {
|
impl ItemKind {
|
||||||
|
@ -1163,6 +1158,8 @@ crate enum Type {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
|
#[derive(Clone, PartialEq, Eq, Hash, Copy, Debug)]
|
||||||
|
/// N.B. this has to be different from `hir::PrimTy` because it also includes types that aren't
|
||||||
|
/// paths, like `Unit`.
|
||||||
crate enum PrimitiveType {
|
crate enum PrimitiveType {
|
||||||
Isize,
|
Isize,
|
||||||
I8,
|
I8,
|
||||||
|
@ -1502,6 +1499,37 @@ impl PrimitiveType {
|
||||||
crate fn to_url_str(&self) -> &'static str {
|
crate fn to_url_str(&self) -> &'static str {
|
||||||
self.as_str()
|
self.as_str()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crate fn as_sym(&self) -> Symbol {
|
||||||
|
use PrimitiveType::*;
|
||||||
|
match self {
|
||||||
|
Isize => sym::isize,
|
||||||
|
I8 => sym::i8,
|
||||||
|
I16 => sym::i16,
|
||||||
|
I32 => sym::i32,
|
||||||
|
I64 => sym::i64,
|
||||||
|
I128 => sym::i128,
|
||||||
|
Usize => sym::usize,
|
||||||
|
U8 => sym::u8,
|
||||||
|
U16 => sym::u16,
|
||||||
|
U32 => sym::u32,
|
||||||
|
U64 => sym::u64,
|
||||||
|
U128 => sym::u128,
|
||||||
|
F32 => sym::f32,
|
||||||
|
F64 => sym::f64,
|
||||||
|
Str => sym::str,
|
||||||
|
Bool => sym::bool,
|
||||||
|
Char => sym::char,
|
||||||
|
Array => sym::array,
|
||||||
|
Slice => sym::slice,
|
||||||
|
Tuple => sym::tuple,
|
||||||
|
Unit => sym::unit,
|
||||||
|
RawPointer => sym::pointer,
|
||||||
|
Reference => sym::reference,
|
||||||
|
Fn => kw::Fn,
|
||||||
|
Never => sym::never,
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<ast::IntTy> for PrimitiveType {
|
impl From<ast::IntTy> for PrimitiveType {
|
||||||
|
|
|
@ -68,7 +68,7 @@ crate fn krate(mut cx: &mut DocContext<'_>) -> Crate {
|
||||||
m.items.extend(primitives.iter().map(|&(def_id, prim)| {
|
m.items.extend(primitives.iter().map(|&(def_id, prim)| {
|
||||||
Item::from_def_id_and_parts(
|
Item::from_def_id_and_parts(
|
||||||
def_id,
|
def_id,
|
||||||
Some(prim.to_url_str().to_owned()),
|
Some(prim.as_sym()),
|
||||||
ItemKind::PrimitiveItem(prim),
|
ItemKind::PrimitiveItem(prim),
|
||||||
cx,
|
cx,
|
||||||
)
|
)
|
||||||
|
|
|
@ -3,6 +3,7 @@ use std::sync::Arc;
|
||||||
use rustc_data_structures::sync::Lrc;
|
use rustc_data_structures::sync::Lrc;
|
||||||
use rustc_session::Session;
|
use rustc_session::Session;
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
|
use rustc_span::Symbol;
|
||||||
|
|
||||||
use crate::clean;
|
use crate::clean;
|
||||||
use crate::config::{RenderInfo, RenderOptions};
|
use crate::config::{RenderInfo, RenderOptions};
|
||||||
|
@ -75,7 +76,7 @@ crate fn run_format<T: FormatRenderer>(
|
||||||
None => return Ok(()),
|
None => return Ok(()),
|
||||||
};
|
};
|
||||||
|
|
||||||
item.name = Some(krate.name.clone());
|
item.name = Some(Symbol::intern(&krate.name));
|
||||||
|
|
||||||
// Render the crate documentation
|
// Render the crate documentation
|
||||||
let mut work = vec![(format_renderer.clone(), item)];
|
let mut work = vec![(format_renderer.clone(), item)];
|
||||||
|
|
|
@ -76,7 +76,7 @@ crate fn build_index(krate: &clean::Crate, cache: &mut Cache) -> String {
|
||||||
if let Some(&(ref fqp, _)) = paths.get(&did) {
|
if let Some(&(ref fqp, _)) = paths.get(&did) {
|
||||||
search_index.push(IndexItem {
|
search_index.push(IndexItem {
|
||||||
ty: item.type_(),
|
ty: item.type_(),
|
||||||
name: item.name.clone().unwrap(),
|
name: item.name.unwrap().to_string(),
|
||||||
path: fqp[..fqp.len() - 1].join("::"),
|
path: fqp[..fqp.len() - 1].join("::"),
|
||||||
desc: item.doc_value().map_or_else(|| String::new(), short_markdown_summary),
|
desc: item.doc_value().map_or_else(|| String::new(), short_markdown_summary),
|
||||||
parent: Some(did),
|
parent: Some(did),
|
||||||
|
|
|
@ -61,7 +61,7 @@ use rustc_session::Session;
|
||||||
use rustc_span::edition::Edition;
|
use rustc_span::edition::Edition;
|
||||||
use rustc_span::hygiene::MacroKind;
|
use rustc_span::hygiene::MacroKind;
|
||||||
use rustc_span::source_map::FileName;
|
use rustc_span::source_map::FileName;
|
||||||
use rustc_span::symbol::{sym, Symbol};
|
use rustc_span::symbol::{kw, sym, Symbol};
|
||||||
use serde::ser::SerializeSeq;
|
use serde::ser::SerializeSeq;
|
||||||
use serde::{Serialize, Serializer};
|
use serde::{Serialize, Serializer};
|
||||||
|
|
||||||
|
@ -665,7 +665,7 @@ impl FormatRenderer for Context {
|
||||||
if !buf.is_empty() {
|
if !buf.is_empty() {
|
||||||
let name = item.name.as_ref().unwrap();
|
let name = item.name.as_ref().unwrap();
|
||||||
let item_type = item.type_();
|
let item_type = item.type_();
|
||||||
let file_name = &item_path(item_type, name);
|
let file_name = &item_path(item_type, &name.as_str());
|
||||||
self.shared.ensure_dir(&self.dst)?;
|
self.shared.ensure_dir(&self.dst)?;
|
||||||
let joint_dst = self.dst.join(file_name);
|
let joint_dst = self.dst.join(file_name);
|
||||||
self.shared.fs.write(&joint_dst, buf.as_bytes())?;
|
self.shared.fs.write(&joint_dst, buf.as_bytes())?;
|
||||||
|
@ -1543,7 +1543,7 @@ impl Context {
|
||||||
if !title.is_empty() {
|
if !title.is_empty() {
|
||||||
title.push_str("::");
|
title.push_str("::");
|
||||||
}
|
}
|
||||||
title.push_str(it.name.as_ref().unwrap());
|
title.push_str(&it.name.unwrap().as_str());
|
||||||
}
|
}
|
||||||
title.push_str(" - Rust");
|
title.push_str(" - Rust");
|
||||||
let tyname = it.type_();
|
let tyname = it.type_();
|
||||||
|
@ -1815,7 +1815,7 @@ fn item_path(ty: ItemType, name: &str) -> String {
|
||||||
fn full_path(cx: &Context, item: &clean::Item) -> String {
|
fn full_path(cx: &Context, item: &clean::Item) -> String {
|
||||||
let mut s = cx.current.join("::");
|
let mut s = cx.current.join("::");
|
||||||
s.push_str("::");
|
s.push_str("::");
|
||||||
s.push_str(item.name.as_ref().unwrap());
|
s.push_str(&item.name.unwrap().as_str());
|
||||||
s
|
s
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2065,9 +2065,9 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
|
||||||
(true, false) => return Ordering::Greater,
|
(true, false) => return Ordering::Greater,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let lhs = i1.name.as_ref().map_or("", |s| &**s);
|
let lhs = i1.name.unwrap_or(kw::Invalid).as_str();
|
||||||
let rhs = i2.name.as_ref().map_or("", |s| &**s);
|
let rhs = i2.name.unwrap_or(kw::Invalid).as_str();
|
||||||
compare_names(lhs, rhs)
|
compare_names(&lhs, &rhs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if cx.shared.sort_modules_alphabetically {
|
if cx.shared.sort_modules_alphabetically {
|
||||||
|
@ -2191,7 +2191,7 @@ fn item_module(w: &mut Buffer, cx: &Context, item: &clean::Item, items: &[clean:
|
||||||
add = add,
|
add = add,
|
||||||
stab = stab.unwrap_or_else(String::new),
|
stab = stab.unwrap_or_else(String::new),
|
||||||
unsafety_flag = unsafety_flag,
|
unsafety_flag = unsafety_flag,
|
||||||
href = item_path(myitem.type_(), myitem.name.as_ref().unwrap()),
|
href = item_path(myitem.type_(), &myitem.name.unwrap().as_str()),
|
||||||
title = [full_path(cx, myitem), myitem.type_().to_string()]
|
title = [full_path(cx, myitem), myitem.type_().to_string()]
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|s| if !s.is_empty() { Some(s.as_str()) } else { None })
|
.filter_map(|s| if !s.is_empty() { Some(s.as_str()) } else { None })
|
||||||
|
@ -2623,7 +2623,7 @@ fn item_trait(w: &mut Buffer, cx: &Context, it: &clean::Item, t: &clean::Trait,
|
||||||
|
|
||||||
fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item, cache: &Cache) {
|
fn trait_item(w: &mut Buffer, cx: &Context, m: &clean::Item, t: &clean::Item, cache: &Cache) {
|
||||||
let name = m.name.as_ref().unwrap();
|
let name = m.name.as_ref().unwrap();
|
||||||
info!("Documenting {} on {}", name, t.name.as_deref().unwrap_or_default());
|
info!("Documenting {} on {:?}", name, t.name);
|
||||||
let item_type = m.type_();
|
let item_type = m.type_();
|
||||||
let id = cx.derive_id(format!("{}.{}", item_type, name));
|
let id = cx.derive_id(format!("{}.{}", item_type, name));
|
||||||
write!(w, "<h3 id=\"{id}\" class=\"method\"><code>", id = id,);
|
write!(w, "<h3 id=\"{id}\" class=\"method\"><code>", id = id,);
|
||||||
|
@ -2951,7 +2951,7 @@ fn render_assoc_item(
|
||||||
AssocItemLink::GotoSource(did, provided_methods) => {
|
AssocItemLink::GotoSource(did, provided_methods) => {
|
||||||
// We're creating a link from an impl-item to the corresponding
|
// We're creating a link from an impl-item to the corresponding
|
||||||
// trait-item and need to map the anchored type accordingly.
|
// trait-item and need to map the anchored type accordingly.
|
||||||
let ty = if provided_methods.contains(name) {
|
let ty = if provided_methods.contains(&*name.as_str()) {
|
||||||
ItemType::Method
|
ItemType::Method
|
||||||
} else {
|
} else {
|
||||||
ItemType::TyMethod
|
ItemType::TyMethod
|
||||||
|
@ -3434,10 +3434,7 @@ fn render_assoc_items(
|
||||||
what: AssocItemRender<'_>,
|
what: AssocItemRender<'_>,
|
||||||
cache: &Cache,
|
cache: &Cache,
|
||||||
) {
|
) {
|
||||||
info!(
|
info!("Documenting associated items of {:?}", containing_item.name);
|
||||||
"Documenting associated items of {}",
|
|
||||||
containing_item.name.as_deref().unwrap_or_default()
|
|
||||||
);
|
|
||||||
let v = match cache.impls.get(&it) {
|
let v = match cache.impls.get(&it) {
|
||||||
Some(v) => v,
|
Some(v) => v,
|
||||||
None => return,
|
None => return,
|
||||||
|
@ -4139,7 +4136,7 @@ fn print_sidebar(cx: &Context, it: &clean::Item, buffer: &mut Buffer, cache: &Ca
|
||||||
ty: \"{ty}\", \
|
ty: \"{ty}\", \
|
||||||
relpath: \"{path}\"\
|
relpath: \"{path}\"\
|
||||||
}};</script>",
|
}};</script>",
|
||||||
name = it.name.as_ref().map(|x| &x[..]).unwrap_or(""),
|
name = it.name.unwrap_or(kw::Invalid),
|
||||||
ty = it.type_(),
|
ty = it.type_(),
|
||||||
path = relpath
|
path = relpath
|
||||||
);
|
);
|
||||||
|
|
|
@ -33,7 +33,7 @@ impl JsonRenderer {
|
||||||
_ => Some(Item {
|
_ => Some(Item {
|
||||||
id: def_id.into(),
|
id: def_id.into(),
|
||||||
crate_id: def_id.krate.as_u32(),
|
crate_id: def_id.krate.as_u32(),
|
||||||
name,
|
name: name.map(|sym| sym.to_string()),
|
||||||
source: self.convert_span(source),
|
source: self.convert_span(source),
|
||||||
visibility: visibility.into(),
|
visibility: visibility.into(),
|
||||||
docs: attrs.collapsed_doc_value().unwrap_or_default(),
|
docs: attrs.collapsed_doc_value().unwrap_or_default(),
|
||||||
|
|
|
@ -668,7 +668,7 @@ fn resolve_associated_trait_item(
|
||||||
// Give precedence to methods that were overridden
|
// Give precedence to methods that were overridden
|
||||||
if !impl_.provided_trait_methods.contains(&*item_name.as_str()) {
|
if !impl_.provided_trait_methods.contains(&*item_name.as_str()) {
|
||||||
let mut items = impl_.items.into_iter().filter_map(|assoc| {
|
let mut items = impl_.items.into_iter().filter_map(|assoc| {
|
||||||
if assoc.name.as_deref() != Some(&*item_name.as_str()) {
|
if assoc.name != Some(item_name) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let kind = assoc
|
let kind = assoc
|
||||||
|
@ -1942,7 +1942,14 @@ fn privacy_error(
|
||||||
dox: &str,
|
dox: &str,
|
||||||
link_range: Option<Range<usize>>,
|
link_range: Option<Range<usize>>,
|
||||||
) {
|
) {
|
||||||
let item_name = item.name.as_deref().unwrap_or("<unknown>");
|
let sym;
|
||||||
|
let item_name = match item.name {
|
||||||
|
Some(name) => {
|
||||||
|
sym = name.as_str();
|
||||||
|
&*sym
|
||||||
|
}
|
||||||
|
None => "<unknown>",
|
||||||
|
};
|
||||||
let msg =
|
let msg =
|
||||||
format!("public documentation for `{}` links to private item `{}`", item_name, path_str);
|
format!("public documentation for `{}` links to private item `{}`", item_name, path_str);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue