Apply suggestions from code review

Co-authored-by: Oli Scherer <github35764891676564198441@oli-obk.de>
This commit is contained in:
Camille Gillot 2021-09-13 20:43:43 +02:00 committed by Camille GILLOT
parent 659b0a2fd9
commit 77c300285c
2 changed files with 2 additions and 2 deletions

View File

@ -671,7 +671,7 @@ pub struct Crate<'hir> {
pub attrs: BTreeMap<HirId, &'hir [Attribute]>, pub attrs: BTreeMap<HirId, &'hir [Attribute]>,
} }
impl<'hir> Crate<'hir> { impl Crate<'hir> {
pub fn module(&self) -> &'hir Mod<'hir> { pub fn module(&self) -> &'hir Mod<'hir> {
if let Some(OwnerNode::Crate(m)) = self.owners[CRATE_DEF_ID] { m } else { panic!() } if let Some(OwnerNode::Crate(m)) = self.owners[CRATE_DEF_ID] { m } else { panic!() }
} }

View File

@ -160,7 +160,7 @@ impl<'hir> Map<'hir> {
pub fn root_module(&self) -> &'hir Mod<'hir> { pub fn root_module(&self) -> &'hir Mod<'hir> {
match self.tcx.hir_owner(CRATE_DEF_ID).map(|o| o.node) { match self.tcx.hir_owner(CRATE_DEF_ID).map(|o| o.node) {
Some(OwnerNode::Crate(item)) => item, Some(OwnerNode::Crate(item)) => item,
_ => panic!(), _ => bug!(),
} }
} }