mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
Remove clean::Mutability enum
This commit is contained in:
parent
0a440b1594
commit
5a0d747eef
@ -7,7 +7,7 @@ use syntax::symbol::sym;
|
|||||||
use syntax_pos::hygiene::MacroKind;
|
use syntax_pos::hygiene::MacroKind;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
use rustc::hir;
|
use rustc::hir::{self, Mutability};
|
||||||
use rustc::hir::def::{Res, DefKind, CtorKind};
|
use rustc::hir::def::{Res, DefKind, CtorKind};
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
use rustc_metadata::creader::LoadedMacro;
|
use rustc_metadata::creader::LoadedMacro;
|
||||||
@ -472,7 +472,7 @@ fn build_const(cx: &DocContext<'_>, did: DefId) -> clean::Constant {
|
|||||||
fn build_static(cx: &DocContext<'_>, did: DefId, mutable: bool) -> clean::Static {
|
fn build_static(cx: &DocContext<'_>, did: DefId, mutable: bool) -> clean::Static {
|
||||||
clean::Static {
|
clean::Static {
|
||||||
type_: cx.tcx.type_of(did).clean(cx),
|
type_: cx.tcx.type_of(did).clean(cx),
|
||||||
mutability: if mutable {clean::Mutable} else {clean::Immutable},
|
mutability: if mutable { Mutability::Mutable } else { Mutability::Immutable },
|
||||||
expr: "\n\n\n".to_string(), // trigger the "[definition]" links
|
expr: "\n\n\n".to_string(), // trigger the "[definition]" links
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,6 @@ pub use utils::{get_auto_trait_and_blanket_impls, krate, register_res};
|
|||||||
|
|
||||||
pub use self::types::*;
|
pub use self::types::*;
|
||||||
pub use self::types::Type::*;
|
pub use self::types::Type::*;
|
||||||
pub use self::types::Mutability::*;
|
|
||||||
pub use self::types::ItemEnum::*;
|
pub use self::types::ItemEnum::*;
|
||||||
pub use self::types::SelfTy::*;
|
pub use self::types::SelfTy::*;
|
||||||
pub use self::types::FunctionRetTy::*;
|
pub use self::types::FunctionRetTy::*;
|
||||||
@ -1321,15 +1320,14 @@ impl Clean<Type> for hir::Ty {
|
|||||||
|
|
||||||
match self.kind {
|
match self.kind {
|
||||||
TyKind::Never => Never,
|
TyKind::Never => Never,
|
||||||
TyKind::Ptr(ref m) => RawPointer(m.mutbl.clean(cx), box m.ty.clean(cx)),
|
TyKind::Ptr(ref m) => RawPointer(m.mutbl, box m.ty.clean(cx)),
|
||||||
TyKind::Rptr(ref l, ref m) => {
|
TyKind::Rptr(ref l, ref m) => {
|
||||||
let lifetime = if l.is_elided() {
|
let lifetime = if l.is_elided() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(l.clean(cx))
|
Some(l.clean(cx))
|
||||||
};
|
};
|
||||||
BorrowedRef {lifetime, mutability: m.mutbl.clean(cx),
|
BorrowedRef {lifetime, mutability: m.mutbl, type_: box m.ty.clean(cx)}
|
||||||
type_: box m.ty.clean(cx)}
|
|
||||||
}
|
}
|
||||||
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)),
|
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)),
|
||||||
TyKind::Array(ref ty, ref length) => {
|
TyKind::Array(ref ty, ref length) => {
|
||||||
@ -1547,10 +1545,10 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
|
|||||||
let n = print_const(cx, n);
|
let n = print_const(cx, n);
|
||||||
Array(box ty.clean(cx), n)
|
Array(box ty.clean(cx), n)
|
||||||
}
|
}
|
||||||
ty::RawPtr(mt) => RawPointer(mt.mutbl.clean(cx), box mt.ty.clean(cx)),
|
ty::RawPtr(mt) => RawPointer(mt.mutbl, box mt.ty.clean(cx)),
|
||||||
ty::Ref(r, ty, mutbl) => BorrowedRef {
|
ty::Ref(r, ty, mutbl) => BorrowedRef {
|
||||||
lifetime: r.clean(cx),
|
lifetime: r.clean(cx),
|
||||||
mutability: mutbl.clean(cx),
|
mutability: mutbl,
|
||||||
type_: box ty.clean(cx),
|
type_: box ty.clean(cx),
|
||||||
},
|
},
|
||||||
ty::FnDef(..) |
|
ty::FnDef(..) |
|
||||||
@ -2073,7 +2071,7 @@ impl Clean<Item> for doctree::Static<'_> {
|
|||||||
deprecation: cx.deprecation(self.id).clean(cx),
|
deprecation: cx.deprecation(self.id).clean(cx),
|
||||||
inner: StaticItem(Static {
|
inner: StaticItem(Static {
|
||||||
type_: self.type_.clean(cx),
|
type_: self.type_.clean(cx),
|
||||||
mutability: self.mutability.clean(cx),
|
mutability: self.mutability,
|
||||||
expr: print_const_expr(cx, self.expr),
|
expr: print_const_expr(cx, self.expr),
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
@ -2098,15 +2096,6 @@ impl Clean<Item> for doctree::Constant<'_> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Clean<Mutability> for hir::Mutability {
|
|
||||||
fn clean(&self, _: &DocContext<'_>) -> Mutability {
|
|
||||||
match self {
|
|
||||||
&hir::Mutability::Mut => Mutable,
|
|
||||||
&hir::Mutability::Not => Immutable,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clean<ImplPolarity> for ty::ImplPolarity {
|
impl Clean<ImplPolarity> for ty::ImplPolarity {
|
||||||
fn clean(&self, _: &DocContext<'_>) -> ImplPolarity {
|
fn clean(&self, _: &DocContext<'_>) -> ImplPolarity {
|
||||||
match self {
|
match self {
|
||||||
@ -2296,7 +2285,7 @@ impl Clean<Item> for doctree::ForeignItem<'_> {
|
|||||||
hir::ForeignItemKind::Static(ref ty, mutbl) => {
|
hir::ForeignItemKind::Static(ref ty, mutbl) => {
|
||||||
ForeignStaticItem(Static {
|
ForeignStaticItem(Static {
|
||||||
type_: ty.clean(cx),
|
type_: ty.clean(cx),
|
||||||
mutability: mutbl.clean(cx),
|
mutability: *mutbl,
|
||||||
expr: String::new(),
|
expr: String::new(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ use std::sync::Arc;
|
|||||||
|
|
||||||
use rustc::middle::lang_items;
|
use rustc::middle::lang_items;
|
||||||
use rustc::middle::stability;
|
use rustc::middle::stability;
|
||||||
use rustc::hir;
|
use rustc::hir::{self, Mutability};
|
||||||
use rustc::hir::def::Res;
|
use rustc::hir::def::Res;
|
||||||
use rustc::hir::def_id::{CrateNum, DefId};
|
use rustc::hir::def_id::{CrateNum, DefId};
|
||||||
use rustc::ty::layout::VariantIdx;
|
use rustc::ty::layout::VariantIdx;
|
||||||
@ -1450,12 +1450,6 @@ pub struct Constant {
|
|||||||
pub expr: String,
|
pub expr: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Copy, Hash)]
|
|
||||||
pub enum Mutability {
|
|
||||||
Mutable,
|
|
||||||
Immutable,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, PartialEq, Debug)]
|
#[derive(Clone, PartialEq, Debug)]
|
||||||
pub enum ImplPolarity {
|
pub enum ImplPolarity {
|
||||||
Positive,
|
Positive,
|
||||||
|
@ -54,12 +54,12 @@ use syntax_pos::hygiene::MacroKind;
|
|||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::DefId;
|
||||||
use rustc::middle::privacy::AccessLevels;
|
use rustc::middle::privacy::AccessLevels;
|
||||||
use rustc::middle::stability;
|
use rustc::middle::stability;
|
||||||
use rustc::hir;
|
use rustc::hir::{self, Mutability};
|
||||||
use rustc::util::nodemap::{FxHashMap, FxHashSet};
|
use rustc::util::nodemap::{FxHashMap, FxHashSet};
|
||||||
use rustc_data_structures::flock;
|
use rustc_data_structures::flock;
|
||||||
use rustc_feature::UnstableFeatures;
|
use rustc_feature::UnstableFeatures;
|
||||||
|
|
||||||
use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy, Mutability};
|
use crate::clean::{self, AttributesExt, Deprecation, GetDefId, SelfTy};
|
||||||
use crate::config::RenderOptions;
|
use crate::config::RenderOptions;
|
||||||
use crate::docfs::{DocFS, ErrorStorage, PathError};
|
use crate::docfs::{DocFS, ErrorStorage, PathError};
|
||||||
use crate::doctree;
|
use crate::doctree;
|
||||||
|
Loading…
Reference in New Issue
Block a user