Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add whitespace around "=" in assoc items #40689

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustdoc/html/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1096,9 +1096,9 @@ impl fmt::Display for clean::ImportSource {
impl fmt::Display for clean::TypeBinding {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
if f.alternate() {
write!(f, "{}={:#}", self.name, self.ty)
write!(f, "{} = {:#}", self.name, self.ty)
} else {
write!(f, "{}={}", self.name, self.ty)
write!(f, "{} = {}", self.name, self.ty)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustdoc/html/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2808,7 +2808,7 @@ fn render_assoc_items(w: &mut fmt::Formatter,
}
AssocItemRender::DerefFor { trait_, type_, deref_mut_ } => {
write!(w, "<h2 id='deref-methods'>Methods from \
{}&lt;Target={}&gt;</h2>", trait_, type_)?;
{}&lt;Target = {}&gt;</h2>", trait_, type_)?;
RenderMode::ForDeref { mut_: deref_mut_ }
}
};
Expand Down
28 changes: 28 additions & 0 deletions src/test/rustdoc/doc-assoc-item.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

pub struct Foo<T> {
x: T,
}

pub trait Bar {
type Fuu;

fn foo(foo: Self::Fuu);
}

// @has doc_assoc_item/struct.Foo.html '//*[@class="impl"]' 'impl<T: Bar<Fuu = u32>> Foo<T>'
impl<T: Bar<Fuu = u32>> Foo<T> {
pub fn new(t: T) -> Foo<T> {
Foo {
x: t,
}
}
}
4 changes: 2 additions & 2 deletions src/test/rustdoc/issue-20646.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ pub trait Trait {
}

// @has issue_20646/fn.fun.html \
// '//*[@class="rust fn"]' 'where T: Trait<Output=i32>'
// '//*[@class="rust fn"]' 'where T: Trait<Output = i32>'
pub fn fun<T>(_: T) where T: Trait<Output=i32> {}

pub mod reexport {
// @has issue_20646/reexport/trait.Trait.html \
// '//*[@id="associatedtype.Output"]' \
// 'type Output'
// @has issue_20646/reexport/fn.fun.html \
// '//*[@class="rust fn"]' 'where T: Trait<Output=i32>'
// '//*[@class="rust fn"]' 'where T: Trait<Output = i32>'
pub use issue_20646::{Trait, fun};
}