rustdoc: Cleanup ABI rendering
Use a common method for rendering `extern "<abi>"`. This now consistently shows `extern "C" fn` rather than just `extern fn`.
This commit is contained in:
parent
887e947178
commit
2b1e35ec12
7 changed files with 48 additions and 21 deletions
|
|
@ -451,11 +451,7 @@ impl fmt::Display for clean::Type {
|
|||
clean::BareFunction(ref decl) => {
|
||||
write!(f, "{}{}fn{}{}",
|
||||
UnsafetySpace(decl.unsafety),
|
||||
match &*decl.abi {
|
||||
"" => " extern ".to_string(),
|
||||
"\"Rust\"" => "".to_string(),
|
||||
s => format!(" extern {} ", s)
|
||||
},
|
||||
AbiSpace(decl.abi),
|
||||
decl.generics,
|
||||
decl.decl)
|
||||
}
|
||||
|
|
@ -770,8 +766,7 @@ impl fmt::Display for AbiSpace {
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.0 {
|
||||
Abi::Rust => Ok(()),
|
||||
Abi::C => write!(f, "extern "),
|
||||
abi => write!(f, "extern {} ", abi),
|
||||
abi => write!(f, "extern "{}" ", abi.name()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2129,8 +2129,6 @@ fn render_assoc_item(w: &mut fmt::Formatter,
|
|||
d: &clean::FnDecl,
|
||||
link: AssocItemLink)
|
||||
-> fmt::Result {
|
||||
use syntax::abi::Abi;
|
||||
|
||||
let name = meth.name.as_ref().unwrap();
|
||||
let anchor = format!("#{}.{}", shortty(meth), name);
|
||||
let href = match link {
|
||||
|
|
@ -2157,10 +2155,7 @@ fn render_assoc_item(w: &mut fmt::Formatter,
|
|||
{generics}{decl}{where_clause}",
|
||||
ConstnessSpace(vis_constness),
|
||||
UnsafetySpace(unsafety),
|
||||
match abi {
|
||||
Abi::Rust => String::new(),
|
||||
a => format!("extern {} ", a.to_string())
|
||||
},
|
||||
AbiSpace(abi),
|
||||
href = href,
|
||||
name = name,
|
||||
generics = *g,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue