use &str instead of String
This commit is contained in:
parent
08aa825eb8
commit
bf7d7ae7fa
2 changed files with 7 additions and 8 deletions
|
@ -2205,8 +2205,8 @@ impl Path {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn last_name(&self) -> String {
|
pub fn last_name(&self) -> &str {
|
||||||
self.segments.last().unwrap().name.clone()
|
self.segments.last().unwrap().name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2110,23 +2110,22 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
|
||||||
<h2 id='implementors'>Implementors</h2>
|
<h2 id='implementors'>Implementors</h2>
|
||||||
<ul class='item-list' id='implementors-list'>
|
<ul class='item-list' id='implementors-list'>
|
||||||
")?;
|
")?;
|
||||||
let mut implementor_count: FxHashMap<String, usize> = FxHashMap();
|
if let Some(implementors) = cache.implementors.get(&it.def_id) {
|
||||||
for (_, implementors) in cache.implementors.iter() {
|
let mut implementor_count: FxHashMap<&str, usize> = FxHashMap();
|
||||||
for implementor in implementors {
|
for implementor in implementors {
|
||||||
if let clean::Type::ResolvedPath {ref path, ..} = implementor.impl_.for_ {
|
if let clean::Type::ResolvedPath {ref path, ..} = implementor.impl_.for_ {
|
||||||
*implementor_count.entry(path.last_name()).or_insert(0) += 1;
|
*implementor_count.entry(path.last_name()).or_insert(0) += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if let Some(implementors) = cache.implementors.get(&it.def_id) {
|
for implementor in implementors {
|
||||||
for implementor in implementors.iter() {
|
|
||||||
write!(w, "<li><code>")?;
|
write!(w, "<li><code>")?;
|
||||||
// If there's already another implementor that has the same abbridged name, use the
|
// If there's already another implementor that has the same abbridged name, use the
|
||||||
// full path, for example in `std::iter::ExactSizeIterator`
|
// full path, for example in `std::iter::ExactSizeIterator`
|
||||||
let dissambiguate = if let clean::Type::ResolvedPath {
|
let dissambiguate = if let clean::Type::ResolvedPath {
|
||||||
ref path, ..
|
ref path, ..
|
||||||
} = implementor.impl_.for_ {
|
} = implementor.impl_.for_ {
|
||||||
*implementor_count.get(&path.last_name()).unwrap_or(&0) > 1
|
implementor_count[path.last_name()] > 1
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue