]> git.lizzy.rs Git - rust.git/commitdiff
rustdoc: Report deprecation reason first
authorVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 14 Oct 2015 22:28:38 +0000 (01:28 +0300)
committerVadim Petrochenkov <vadim.petrochenkov@gmail.com>
Wed, 14 Oct 2015 22:28:38 +0000 (01:28 +0300)
src/librustdoc/clean/mod.rs

index 88e254b86b213bf6f55deebae31890545bb2ece7..defdfc497bdbf557c2ff0b4df5b19a6aeb77674d 100644 (file)
@@ -2700,9 +2700,14 @@ fn clean(&self, _: &DocContext) -> Stability {
                 Some(attr::Deprecation {ref since, ..}) => since.to_string(),
                 _=> "".to_string(),
             },
-            reason: match self.level {
-                attr::Unstable {reason: Some(ref reason), ..} => reason.to_string(),
-                _ => "".to_string(),
+            reason: {
+                if let Some(ref depr) = self.depr {
+                    depr.reason.to_string()
+                } else if let attr::Unstable {reason: Some(ref reason), ..} = self.level {
+                    reason.to_string()
+                } else {
+                    "".to_string()
+                }
             },
             issue: match self.level {
                 attr::Unstable {issue, ..} => Some(issue),