1
Fork 0

use &str instead of String

This commit is contained in:
bluss 2016-12-21 21:27:31 -08:00 committed by Esteban Küber
parent 08aa825eb8
commit bf7d7ae7fa
2 changed files with 7 additions and 8 deletions

View file

@ -2110,23 +2110,22 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
<h2 id='implementors'>Implementors</h2>
<ul class='item-list' id='implementors-list'>
")?;
let mut implementor_count: FxHashMap<String, usize> = FxHashMap();
for (_, implementors) in cache.implementors.iter() {
if let Some(implementors) = cache.implementors.get(&it.def_id) {
let mut implementor_count: FxHashMap<&str, usize> = FxHashMap();
for implementor in implementors {
if let clean::Type::ResolvedPath {ref path, ..} = implementor.impl_.for_ {
*implementor_count.entry(path.last_name()).or_insert(0) += 1;
}
}
}
if let Some(implementors) = cache.implementors.get(&it.def_id) {
for implementor in implementors.iter() {
for implementor in implementors {
write!(w, "<li><code>")?;
// If there's already another implementor that has the same abbridged name, use the
// full path, for example in `std::iter::ExactSizeIterator`
let dissambiguate = if let clean::Type::ResolvedPath {
ref path, ..
} = implementor.impl_.for_ {
*implementor_count.get(&path.last_name()).unwrap_or(&0) > 1
implementor_count[path.last_name()] > 1
} else {
false
};