]> git.lizzy.rs Git - rust.git/commitdiff
Migrate ItemType::from_type_kind to convert::From.
authorCorey Farwell <coreyf@rwell.org>
Sat, 20 Aug 2016 19:55:43 +0000 (15:55 -0400)
committerCorey Farwell <coreyf@rwell.org>
Thu, 25 Aug 2016 06:25:26 +0000 (23:25 -0700)
src/librustdoc/html/item_type.rs
src/librustdoc/html/render.rs

index 31d965fccc2c0030e3d27bd8c90c25716ff17e3f..be192179284676b9b76fa40162cf22c4ef8ffc31 100644 (file)
@@ -85,8 +85,8 @@ fn from(item: &'a clean::Item) -> ItemType {
     }
 }
 
-impl ItemType {
-    pub fn from_type_kind(kind: clean::TypeKind) -> ItemType {
+impl From<clean::TypeKind> for ItemType {
+    fn from(kind: clean::TypeKind) -> ItemType {
         match kind {
             clean::TypeStruct   => ItemType::Struct,
             clean::TypeEnum     => ItemType::Enum,
@@ -99,7 +99,9 @@ pub fn from_type_kind(kind: clean::TypeKind) -> ItemType {
             clean::TypeTypedef  => ItemType::Typedef,
         }
     }
+}
 
+impl ItemType {
     pub fn css_class(&self) -> &'static str {
         match *self {
             ItemType::Module          => "mod",
index 66f54587e6b328f3a48fa24aaf88a7dd7b5783f9..6993f85c3d9a47f1a0d39697f0e04191b760a522 100644 (file)
@@ -509,7 +509,7 @@ pub fn run(mut krate: clean::Crate,
     } = renderinfo;
 
     let external_paths = external_paths.into_iter()
-        .map(|(k, (v, t))| (k, (v, ItemType::from_type_kind(t))))
+        .map(|(k, (v, t))| (k, (v, ItemType::from(t))))
         .collect();
 
     let mut cache = Cache {