diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-03-22 19:30:28 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-22 19:30:28 -0400 |
| commit | 88d40dc773e35e7d7b9af30a579b8adf41552f9c (patch) | |
| tree | 5338cfd605759c59a3fe3a6e383453e242513136 | |
| parent | 5947db1d4e08fc5f3bb2f90bacc9dc0804846a58 (diff) | |
| parent | f53172287a4ebb57e8372ce2647628887a268696 (diff) | |
| download | rust-88d40dc773e35e7d7b9af30a579b8adf41552f9c.tar.gz rust-88d40dc773e35e7d7b9af30a579b8adf41552f9c.zip | |
Rollup merge of #40689 - GuillaumeGomez:rustdoc-associated-type-formatting, r=frewsxcv
Add whitespace around "=" in assoc items Part of #40641. r? @rust-lang/docs Before: <img width="1440" alt="screen shot 2017-03-20 at 22 42 34" src="https://cloud.githubusercontent.com/assets/3050060/24123102/89181d8c-0dbe-11e7-897c-841497cf7001.png"> After: <img width="1440" alt="screen shot 2017-03-20 at 22 42 36" src="https://cloud.githubusercontent.com/assets/3050060/24123118/8dec176e-0dbe-11e7-9759-cabbd062a4c2.png">
| -rw-r--r-- | src/librustdoc/html/format.rs | 4 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 2 | ||||
| -rw-r--r-- | src/test/rustdoc/doc-assoc-item.rs | 28 | ||||
| -rw-r--r-- | src/test/rustdoc/issue-20646.rs | 4 |
4 files changed, 33 insertions, 5 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index a255ba0ad4e..9f2d02c14dd 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -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) } } } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 7b60d497932..10fde67a456 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -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 \ - {}<Target={}></h2>", trait_, type_)?; + {}<Target = {}></h2>", trait_, type_)?; RenderMode::ForDeref { mut_: deref_mut_ } } }; diff --git a/src/test/rustdoc/doc-assoc-item.rs b/src/test/rustdoc/doc-assoc-item.rs new file mode 100644 index 00000000000..36f44295953 --- /dev/null +++ b/src/test/rustdoc/doc-assoc-item.rs @@ -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, + } + } +} diff --git a/src/test/rustdoc/issue-20646.rs b/src/test/rustdoc/issue-20646.rs index 87c40d11579..49fac20035f 100644 --- a/src/test/rustdoc/issue-20646.rs +++ b/src/test/rustdoc/issue-20646.rs @@ -23,7 +23,7 @@ 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 { @@ -31,6 +31,6 @@ pub mod reexport { // '//*[@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}; } |
