Skip to content

Commit 9fc71b4

Browse files
committed
Remove unneeded use of Cell
1 parent 79a3f22 commit 9fc71b4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/librustc_resolve/lib.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,7 @@ enum ParentLink<'a> {
790790
/// One node in the tree of modules.
791791
pub struct ModuleS<'a> {
792792
parent_link: ParentLink<'a>,
793-
def: Cell<Option<Def>>,
793+
def: Option<Def>,
794794
is_public: bool,
795795
is_extern_crate: bool,
796796

@@ -840,7 +840,7 @@ impl<'a> ModuleS<'a> {
840840
fn new(parent_link: ParentLink<'a>, def: Option<Def>, external: bool, is_public: bool) -> Self {
841841
ModuleS {
842842
parent_link: parent_link,
843-
def: Cell::new(def),
843+
def: def,
844844
is_public: is_public,
845845
is_extern_crate: false,
846846
children: RefCell::new(HashMap::new()),
@@ -878,18 +878,18 @@ impl<'a> ModuleS<'a> {
878878
}
879879

880880
fn def_id(&self) -> Option<DefId> {
881-
self.def.get().as_ref().map(Def::def_id)
881+
self.def.as_ref().map(Def::def_id)
882882
}
883883

884884
fn is_normal(&self) -> bool {
885-
match self.def.get() {
885+
match self.def {
886886
Some(Def::Mod(_)) | Some(Def::ForeignMod(_)) => true,
887887
_ => false,
888888
}
889889
}
890890

891891
fn is_trait(&self) -> bool {
892-
match self.def.get() {
892+
match self.def {
893893
Some(Def::Trait(_)) => true,
894894
_ => false,
895895
}
@@ -988,7 +988,7 @@ impl<'a> NameBinding<'a> {
988988
fn def(&self) -> Option<Def> {
989989
match self.def_or_module {
990990
DefOrModule::Def(def) => Some(def),
991-
DefOrModule::Module(ref module) => module.def.get(),
991+
DefOrModule::Module(ref module) => module.def,
992992
}
993993
}
994994

0 commit comments

Comments
 (0)