1
Fork 0

use same param name across methods

This commit is contained in:
Esteban Küber 2016-12-22 23:20:22 -08:00
parent de69a3b7e5
commit 346a442110
2 changed files with 12 additions and 9 deletions

View file

@ -561,14 +561,14 @@ impl<'a> fmt::Display for HRef<'a> {
} }
} }
fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, full_path: bool) -> fmt::Result { fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt::Result {
match *t { match *t {
clean::Generic(ref name) => { clean::Generic(ref name) => {
f.write_str(name) f.write_str(name)
} }
clean::ResolvedPath{ did, ref typarams, ref path, is_generic } => { clean::ResolvedPath{ did, ref typarams, ref path, is_generic } => {
// Paths like T::Output and Self::Output should be rendered with all segments // Paths like T::Output and Self::Output should be rendered with all segments
resolved_path(f, did, path, is_generic, full_path)?; resolved_path(f, did, path, is_generic, use_absolute)?;
tybounds(f, typarams) tybounds(f, typarams)
} }
clean::Infer => write!(f, "_"), clean::Infer => write!(f, "_"),
@ -727,7 +727,7 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, full_path: bool) -> fmt::Re
write!(f, "{}::", self_type)?; write!(f, "{}::", self_type)?;
} }
let path = clean::Path::singleton(name.clone()); let path = clean::Path::singleton(name.clone());
resolved_path(f, did, &path, true, full_path)?; resolved_path(f, did, &path, true, use_absolute)?;
// FIXME: `typarams` are not rendered, and this seems bad? // FIXME: `typarams` are not rendered, and this seems bad?
drop(typarams); drop(typarams);
@ -752,7 +752,10 @@ impl fmt::Display for clean::Type {
} }
} }
fn fmt_impl(i: &clean::Impl, f: &mut fmt::Formatter, link_trait: bool, full: bool) -> fmt::Result { fn fmt_impl(i: &clean::Impl,
f: &mut fmt::Formatter,
link_trait: bool,
use_absolute: bool) -> fmt::Result {
let mut plain = String::new(); let mut plain = String::new();
if f.alternate() { if f.alternate() {
@ -786,7 +789,7 @@ fn fmt_impl(i: &clean::Impl, f: &mut fmt::Formatter, link_trait: bool, full: boo
plain.push_str(" for "); plain.push_str(" for ");
} }
fmt_type(&i.for_, f, full)?; fmt_type(&i.for_, f, use_absolute)?;
plain.push_str(&format!("{:#}", i.for_)); plain.push_str(&format!("{:#}", i.for_));
fmt::Display::fmt(&WhereClause(&i.generics, plain.len() + 1), f)?; fmt::Display::fmt(&WhereClause(&i.generics, plain.len() + 1), f)?;
@ -802,8 +805,8 @@ impl fmt::Display for clean::Impl {
// The difference from above is that trait is not hyperlinked. // The difference from above is that trait is not hyperlinked.
pub fn fmt_impl_for_trait_page(i: &clean::Impl, pub fn fmt_impl_for_trait_page(i: &clean::Impl,
f: &mut fmt::Formatter, f: &mut fmt::Formatter,
disambiguate: bool) -> fmt::Result { use_absolute: bool) -> fmt::Result {
fmt_impl(i, f, false, disambiguate) fmt_impl(i, f, false, use_absolute)
} }
impl fmt::Display for clean::Arguments { impl fmt::Display for clean::Arguments {

View file

@ -2122,14 +2122,14 @@ fn item_trait(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item,
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 use_absolute = if let clean::Type::ResolvedPath {
ref path, .. ref path, ..
} = implementor.impl_.for_ { } = implementor.impl_.for_ {
implementor_count[path.last_name()] > 1 implementor_count[path.last_name()] > 1
} else { } else {
false false
}; };
fmt_impl_for_trait_page(&implementor.impl_, w, dissambiguate)?; fmt_impl_for_trait_page(&implementor.impl_, w, use_absolute)?;
writeln!(w, "</code></li>")?; writeln!(w, "</code></li>")?;
} }
} }