From 9fc71b45066bb9714dc1a1ab91e989b735f8cdef Mon Sep 17 00:00:00 2001 From: Jeffrey Seyfried Date: Sun, 31 Jan 2016 00:41:26 +0000 Subject: [PATCH] Remove unneeded use of Cell --- src/librustc_resolve/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index a12eb42ccd482..d2e6273790dd1 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -790,7 +790,7 @@ enum ParentLink<'a> { /// One node in the tree of modules. pub struct ModuleS<'a> { parent_link: ParentLink<'a>, - def: Cell>, + def: Option, is_public: bool, is_extern_crate: bool, @@ -840,7 +840,7 @@ impl<'a> ModuleS<'a> { fn new(parent_link: ParentLink<'a>, def: Option, external: bool, is_public: bool) -> Self { ModuleS { parent_link: parent_link, - def: Cell::new(def), + def: def, is_public: is_public, is_extern_crate: false, children: RefCell::new(HashMap::new()), @@ -878,18 +878,18 @@ impl<'a> ModuleS<'a> { } fn def_id(&self) -> Option { - self.def.get().as_ref().map(Def::def_id) + self.def.as_ref().map(Def::def_id) } fn is_normal(&self) -> bool { - match self.def.get() { + match self.def { Some(Def::Mod(_)) | Some(Def::ForeignMod(_)) => true, _ => false, } } fn is_trait(&self) -> bool { - match self.def.get() { + match self.def { Some(Def::Trait(_)) => true, _ => false, } @@ -988,7 +988,7 @@ impl<'a> NameBinding<'a> { fn def(&self) -> Option { match self.def_or_module { DefOrModule::Def(def) => Some(def), - DefOrModule::Module(ref module) => module.def.get(), + DefOrModule::Module(ref module) => module.def, } }