diff options
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 20 | ||||
| -rw-r--r-- | src/librustdoc/html/item_type.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/html/render.rs | 2 |
3 files changed, 15 insertions, 13 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 7a4558d7b79..d5149293e09 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -287,34 +287,34 @@ impl Item { } } pub fn is_mod(&self) -> bool { - ItemType::from_item(self) == ItemType::Module + ItemType::from(self) == ItemType::Module } pub fn is_trait(&self) -> bool { - ItemType::from_item(self) == ItemType::Trait + ItemType::from(self) == ItemType::Trait } pub fn is_struct(&self) -> bool { - ItemType::from_item(self) == ItemType::Struct + ItemType::from(self) == ItemType::Struct } pub fn is_enum(&self) -> bool { - ItemType::from_item(self) == ItemType::Module + ItemType::from(self) == ItemType::Module } pub fn is_fn(&self) -> bool { - ItemType::from_item(self) == ItemType::Function + ItemType::from(self) == ItemType::Function } pub fn is_associated_type(&self) -> bool { - ItemType::from_item(self) == ItemType::AssociatedType + ItemType::from(self) == ItemType::AssociatedType } pub fn is_associated_const(&self) -> bool { - ItemType::from_item(self) == ItemType::AssociatedConst + ItemType::from(self) == ItemType::AssociatedConst } pub fn is_method(&self) -> bool { - ItemType::from_item(self) == ItemType::Method + ItemType::from(self) == ItemType::Method } pub fn is_ty_method(&self) -> bool { - ItemType::from_item(self) == ItemType::TyMethod + ItemType::from(self) == ItemType::TyMethod } pub fn is_primitive(&self) -> bool { - ItemType::from_item(self) == ItemType::Primitive + ItemType::from(self) == ItemType::Primitive } pub fn is_stripped(&self) -> bool { match self.inner { StrippedItem(..) => true, _ => false } diff --git a/src/librustdoc/html/item_type.rs b/src/librustdoc/html/item_type.rs index 6b462a76f04..31d965fccc2 100644 --- a/src/librustdoc/html/item_type.rs +++ b/src/librustdoc/html/item_type.rs @@ -50,8 +50,8 @@ pub enum NameSpace { Macro, } -impl ItemType { - pub fn from_item(item: &clean::Item) -> ItemType { +impl<'a> From<&'a clean::Item> for ItemType { + fn from(item: &'a clean::Item) -> ItemType { let inner = match item.inner { clean::StrippedItem(box ref item) => item, ref inner@_ => inner, @@ -83,7 +83,9 @@ impl ItemType { clean::StrippedItem(..) => unreachable!(), } } +} +impl ItemType { pub fn from_type_kind(kind: clean::TypeKind) -> ItemType { match kind { clean::TypeStruct => ItemType::Struct, diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 5b878c22e79..66f54587e6b 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -833,7 +833,7 @@ fn mkdir(path: &Path) -> io::Result<()> { /// Returns a documentation-level item type from the item. fn item_type(item: &clean::Item) -> ItemType { - ItemType::from_item(item) + ItemType::from(item) } /// Takes a path to a source file and cleans the path to it. This canonicalizes |
