about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-19 00:07:58 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-20 17:44:31 +0530
commit9ce018bafbda6f1d8484adf4796a48e5cf9093bb (patch)
treeeec994e3bb00a73c0b619d6090b041118ac958c4
parent74633b08e057d62fcd2c221c305fe854c4189f04 (diff)
downloadrust-9ce018bafbda6f1d8484adf4796a48e5cf9093bb.tar.gz
rust-9ce018bafbda6f1d8484adf4796a48e5cf9093bb.zip
Update tests
-rw-r--r--src/librustdoc/html/render.rs32
-rw-r--r--src/test/rustdoc/manual_impl.rs25
2 files changed, 36 insertions, 21 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index e37cb1878d0..7b626dbc750 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -1660,7 +1660,8 @@ fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Re
 fn document_short(w: &mut fmt::Formatter, item: &clean::Item, link: AssocItemLink) -> fmt::Result {
     if let Some(s) = item.doc_value() {
         let markdown = if s.contains('\n') {
-            format!("{} [Read more]({})", &plain_summary_line(Some(s)), naive_assoc_href(item, link))
+            format!("{} [Read more]({})",
+                    &plain_summary_line(Some(s)), naive_assoc_href(item, link))
         } else {
             format!("{}", &plain_summary_line(Some(s)))
         };
@@ -2619,25 +2620,26 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi
             _ => panic!("can't make docs for trait item with name {:?}", item.name)
         }
 
-        if !is_default_item && (!is_static || render_static) {
+        if !is_static || render_static {
+            if !is_default_item {
 
-            if item.doc_value().is_some() {
-                document(w, cx, item)
-            } else {
-                // In case the item isn't documented,
-                // provide short documentation from the trait
-                if let Some(t) = trait_ {
-                    if let Some(it) = t.items.iter()
-                                       .find(|i| i.name == item.name) {
-                        document_short(w, it, link)?;
+                if item.doc_value().is_some() {
+                    document(w, cx, item)?;
+                } else {
+                    // In case the item isn't documented,
+                    // provide short documentation from the trait
+                    if let Some(t) = trait_ {
+                        if let Some(it) = t.items.iter()
+                                           .find(|i| i.name == item.name) {
+                            document_short(w, it, link)?;
+                        }
                     }
                 }
-                Ok(())
+            } else {
+                document_short(w, item, link)?;
             }
-        } else {
-            document_short(w, item, link)?;
-            Ok(())
         }
+        Ok(())
     }
 
     let traits = &cache().traits;
diff --git a/src/test/rustdoc/manual_impl.rs b/src/test/rustdoc/manual_impl.rs
index 5eccf97bb5f..befd3161ac4 100644
--- a/src/test/rustdoc/manual_impl.rs
+++ b/src/test/rustdoc/manual_impl.rs
@@ -21,13 +21,24 @@ pub trait T {
     fn b_method(&self) -> usize {
         self.a_method()
     }
+
+    /// Docs associated with the trait c_method definition.
+    ///
+    /// There is another line
+    fn c_method(&self) -> usize {
+        self.a_method()
+    }
 }
 
 // @has manual_impl/struct.S1.html '//*[@class="trait"]' 'T'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait implementation.'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S1 trait a_method implementation.'
 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
-// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
+// @!has - '//*[@class="docblock"]' 'There is another line'
+// @has - '//*[@class="docblock"]' 'Read more'
 pub struct S1(usize);
 
 /// Docs associated with the S1 trait implementation.
@@ -41,9 +52,11 @@ impl T for S1 {
 // @has manual_impl/struct.S2.html '//*[@class="trait"]' 'T'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait implementation.'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait a_method implementation.'
-// @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait b_method implementation.'
+// @has  - '//*[@class="docblock"]' 'Docs associated with the S2 trait c_method implementation.'
 // @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
-// @!has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @!has - '//*[@class="docblock"]' 'Docs associated with the trait c_method definition.'
+// @has - '//*[@class="docblock"]' 'Docs associated with the trait b_method definition.'
+// @!has - '//*[@class="docblock"]' 'Read more'
 pub struct S2(usize);
 
 /// Docs associated with the S2 trait implementation.
@@ -53,8 +66,8 @@ impl T for S2 {
         self.0
     }
 
-    /// Docs associated with the S2 trait b_method implementation.
-    fn b_method(&self) -> usize {
+    /// Docs associated with the S2 trait c_method implementation.
+    fn c_method(&self) -> usize {
         5
     }
 }
@@ -62,7 +75,7 @@ impl T for S2 {
 // @has manual_impl/struct.S3.html '//*[@class="trait"]' 'T'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait implementation.'
 // @has  - '//*[@class="docblock"]' 'Docs associated with the S3 trait b_method implementation.'
-// @!has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
+// @has - '//*[@class="docblock"]' 'Docs associated with the trait a_method definition.'
 pub struct S3(usize);
 
 /// Docs associated with the S3 trait implementation.