Add make tidy fixes
This commit is contained in:
parent
23a8c7d4d9
commit
f75c8a98dd
9 changed files with 54 additions and 23 deletions
|
|
@ -184,7 +184,10 @@ impl<'a> FnLikeNode<'a> {
|
|||
}
|
||||
|
||||
pub fn decl(self) -> &'a FnDecl {
|
||||
if let map::NodeInlinedItem(&InlinedItem { kind: InlinedItemKind::Fn(ref decl), .. }) = self.node {
|
||||
if let map::NodeInlinedItem(&InlinedItem {
|
||||
kind: InlinedItemKind::Fn(ref decl),
|
||||
..
|
||||
}) = self.node {
|
||||
return &decl;
|
||||
}
|
||||
self.handle(|i: ItemFnParts<'a>| &*i.decl,
|
||||
|
|
|
|||
|
|
@ -601,7 +601,7 @@ impl<'ast> Map<'ast> {
|
|||
pub fn get_parent_did(&self, id: NodeId) -> DefId {
|
||||
let parent = self.get_parent(id);
|
||||
match self.find_entry(parent) {
|
||||
Some(RootInlinedParent(ii)) => ii.def_id, // TODO: is this wrong for items?
|
||||
Some(RootInlinedParent(ii)) => ii.def_id,
|
||||
_ => self.local_def_id(parent)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,9 +165,13 @@ pub enum InlinedItemKindRef<'a> {
|
|||
}
|
||||
|
||||
impl<'a> InlinedItemRef<'a> {
|
||||
pub fn from_item<'ast: 'a>(def_id: DefId, item: &'a hir::Item, map: &hir_map::Map<'ast>) -> InlinedItemRef<'a> {
|
||||
pub fn from_item<'ast: 'a>(def_id: DefId,
|
||||
item: &'a hir::Item,
|
||||
map: &hir_map::Map<'ast>)
|
||||
-> InlinedItemRef<'a> {
|
||||
let (body, kind) = match item.node {
|
||||
hir::ItemFn(ref decl, _, _, _, _, body_id) => (map.expr(body_id), InlinedItemKindRef::Fn(&decl)),
|
||||
hir::ItemFn(ref decl, _, _, _, _, body_id) =>
|
||||
(map.expr(body_id), InlinedItemKindRef::Fn(&decl)),
|
||||
hir::ItemConst(ref ty, ref body) => (&**body, InlinedItemKindRef::Const(ty)),
|
||||
_ => bug!("InlinedItemRef::from_item wrong kind")
|
||||
};
|
||||
|
|
@ -178,10 +182,15 @@ impl<'a> InlinedItemRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_trait_item(def_id: DefId, item: &'a hir::TraitItem, _map: &hir_map::Map) -> InlinedItemRef<'a> {
|
||||
pub fn from_trait_item(def_id: DefId,
|
||||
item: &'a hir::TraitItem,
|
||||
_map: &hir_map::Map)
|
||||
-> InlinedItemRef<'a> {
|
||||
let (body, kind) = match item.node {
|
||||
hir::ConstTraitItem(ref ty, Some(ref body)) => (&**body, InlinedItemKindRef::Const(ty)),
|
||||
hir::ConstTraitItem(_, None) => bug!("InlinedItemRef::from_trait_item called for const without body"),
|
||||
hir::ConstTraitItem(_, None) => {
|
||||
bug!("InlinedItemRef::from_trait_item called for const without body")
|
||||
},
|
||||
_ => bug!("InlinedItemRef::from_trait_item wrong kind")
|
||||
};
|
||||
InlinedItemRef {
|
||||
|
|
@ -191,9 +200,13 @@ impl<'a> InlinedItemRef<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_impl_item<'ast: 'a>(def_id: DefId, item: &'a hir::ImplItem, map: &hir_map::Map<'ast>) -> InlinedItemRef<'a> {
|
||||
pub fn from_impl_item<'ast: 'a>(def_id: DefId,
|
||||
item: &'a hir::ImplItem,
|
||||
map: &hir_map::Map<'ast>)
|
||||
-> InlinedItemRef<'a> {
|
||||
let (body, kind) = match item.node {
|
||||
hir::ImplItemKind::Method(ref sig, body_id) => (map.expr(body_id), InlinedItemKindRef::Fn(&sig.decl)),
|
||||
hir::ImplItemKind::Method(ref sig, body_id) =>
|
||||
(map.expr(body_id), InlinedItemKindRef::Fn(&sig.decl)),
|
||||
hir::ImplItemKind::Const(ref ty, ref body) => (&**body, InlinedItemKindRef::Const(ty)),
|
||||
_ => bug!("InlinedItemRef::from_impl_item wrong kind")
|
||||
};
|
||||
|
|
|
|||
|
|
@ -850,7 +850,8 @@ fn resolve_expr<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx, 'a>, expr:
|
|||
visitor.cx = prev_cx;
|
||||
}
|
||||
|
||||
fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx, 'a>, local: &'tcx hir::Local) {
|
||||
fn resolve_local<'a, 'tcx>(visitor: &mut RegionResolutionVisitor<'tcx, 'a>,
|
||||
local: &'tcx hir::Local) {
|
||||
debug!("resolve_local(local.id={:?},local.init={:?})",
|
||||
local.id,local.init.is_some());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue