Tidy.
This commit is contained in:
parent
9694ab9e18
commit
5f5b6e7c67
@ -948,7 +948,10 @@ pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'
|
||||
visitor.visit_defaultness(defaultness);
|
||||
}
|
||||
|
||||
pub fn walk_struct_def<'v, V: Visitor<'v>>(visitor: &mut V, struct_definition: &'v VariantData<'v>) {
|
||||
pub fn walk_struct_def<'v, V: Visitor<'v>>(
|
||||
visitor: &mut V,
|
||||
struct_definition: &'v VariantData<'v>,
|
||||
) {
|
||||
if let Some(ctor_hir_id) = struct_definition.ctor_hir_id() {
|
||||
visitor.visit_id(ctor_hir_id);
|
||||
}
|
||||
|
@ -1579,7 +1579,9 @@ struct ImplTraitLifetimeCollector<'r, 'a, 'hir> {
|
||||
output_lifetime_params: Vec<hir::GenericParam>,
|
||||
}
|
||||
|
||||
impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v> for ImplTraitLifetimeCollector<'r, 'a, 'hir> {
|
||||
impl<'r, 'a, 'v, 'hir> hir::intravisit::Visitor<'v>
|
||||
for ImplTraitLifetimeCollector<'r, 'a, 'hir>
|
||||
{
|
||||
fn nested_visit_map<'this>(
|
||||
&'this mut self,
|
||||
) -> hir::intravisit::NestedVisitorMap<'this, 'v> {
|
||||
|
@ -164,7 +164,9 @@ fn without_in_scope_lifetime_defs<T>(
|
||||
pub(super) fn lower_mod(&mut self, m: &Mod) -> hir::Mod<'hir> {
|
||||
hir::Mod {
|
||||
inner: m.inner,
|
||||
item_ids: self.arena.alloc_from_iter(m.items.iter().flat_map(|x| self.lower_item_id(x))),
|
||||
item_ids: self.arena.alloc_from_iter(
|
||||
m.items.iter().flat_map(|x| self.lower_item_id(x))
|
||||
),
|
||||
}
|
||||
}
|
||||
|
||||
@ -560,7 +562,8 @@ fn lower_use_tree(
|
||||
});
|
||||
}
|
||||
|
||||
let path = self.arena.alloc(self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None));
|
||||
let path = self.lower_path_extra(ret_res, &path, ParamMode::Explicit, None);
|
||||
let path = self.arena.alloc(path);
|
||||
hir::ItemKind::Use(path, hir::UseKind::Single)
|
||||
}
|
||||
UseTreeKind::Glob => {
|
||||
@ -667,7 +670,8 @@ fn lower_use_tree(
|
||||
|
||||
let res = self.expect_full_res_from_use(id).next().unwrap_or(Res::Err);
|
||||
let res = self.lower_res(res);
|
||||
let path = self.arena.alloc(self.lower_path_extra(res, &prefix, ParamMode::Explicit, None));
|
||||
let path = self.lower_path_extra(res, &prefix, ParamMode::Explicit, None);
|
||||
let path = self.arena.alloc(path);
|
||||
hir::ItemKind::Use(path, hir::UseKind::ListStem)
|
||||
}
|
||||
}
|
||||
@ -733,8 +737,8 @@ fn lower_foreign_item(&mut self, i: &ForeignItem) -> hir::ForeignItem<'hir> {
|
||||
hir::ForeignItemKind::Fn(fn_dec, fn_args, generics)
|
||||
}
|
||||
ForeignItemKind::Static(ref t, m) => {
|
||||
hir::ForeignItemKind::Static(
|
||||
self.arena.alloc(self.lower_ty(t, ImplTraitContext::disallowed()).into_inner()), m)
|
||||
let ty = self.lower_ty(t, ImplTraitContext::disallowed());
|
||||
hir::ForeignItemKind::Static(self.arena.alloc(ty.into_inner()), m)
|
||||
}
|
||||
ForeignItemKind::Ty => hir::ForeignItemKind::Type,
|
||||
ForeignItemKind::Macro(_) => panic!("macro shouldn't exist here"),
|
||||
@ -771,7 +775,9 @@ fn lower_variant(&mut self, v: &Variant) -> hir::Variant<'hir> {
|
||||
fn lower_variant_data(&mut self, vdata: &VariantData) -> hir::VariantData<'hir> {
|
||||
match *vdata {
|
||||
VariantData::Struct(ref fields, recovered) => hir::VariantData::Struct(
|
||||
self.arena.alloc_from_iter(fields.iter().enumerate().map(|f| self.lower_struct_field(f))),
|
||||
self.arena.alloc_from_iter(
|
||||
fields.iter().enumerate().map(|f| self.lower_struct_field(f))
|
||||
),
|
||||
recovered,
|
||||
),
|
||||
VariantData::Tuple(ref fields, id) => {
|
||||
@ -823,15 +829,17 @@ fn lower_trait_item(&mut self, i: &AssocItem) -> hir::TraitItem<'hir> {
|
||||
let trait_item_def_id = self.resolver.definitions().local_def_id(i.id);
|
||||
|
||||
let (generics, kind) = match i.kind {
|
||||
AssocItemKind::Const(ref ty, ref default) => (
|
||||
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
|
||||
hir::TraitItemKind::Const(
|
||||
self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
|
||||
AssocItemKind::Const(ref ty, ref default) => {
|
||||
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
|
||||
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
|
||||
let ty = self.arena.alloc(ty.into_inner());
|
||||
(generics, hir::TraitItemKind::Const(
|
||||
ty,
|
||||
default
|
||||
.as_ref()
|
||||
.map(|x| self.lower_const_body(i.span, Some(x))),
|
||||
),
|
||||
),
|
||||
))
|
||||
},
|
||||
AssocItemKind::Fn(ref sig, None) => {
|
||||
let names = self.lower_fn_params_to_names(&sig.decl);
|
||||
let (generics, sig) = self.lower_method_sig(
|
||||
@ -913,13 +921,15 @@ fn lower_impl_item(&mut self, i: &AssocItem) -> hir::ImplItem<'hir> {
|
||||
let impl_item_def_id = self.resolver.definitions().local_def_id(i.id);
|
||||
|
||||
let (generics, kind) = match i.kind {
|
||||
AssocItemKind::Const(ref ty, ref expr) => (
|
||||
self.lower_generics(&i.generics, ImplTraitContext::disallowed()),
|
||||
hir::ImplItemKind::Const(
|
||||
self.arena.alloc(self.lower_ty(ty, ImplTraitContext::disallowed()).into_inner()),
|
||||
AssocItemKind::Const(ref ty, ref expr) => {
|
||||
let generics = self.lower_generics(&i.generics, ImplTraitContext::disallowed());
|
||||
let ty = self.lower_ty(ty, ImplTraitContext::disallowed());
|
||||
let ty = self.arena.alloc(ty.into_inner());
|
||||
(generics, hir::ImplItemKind::Const(
|
||||
ty,
|
||||
self.lower_const_body(i.span, expr.as_deref()),
|
||||
),
|
||||
),
|
||||
))
|
||||
},
|
||||
AssocItemKind::Fn(ref sig, ref body) => {
|
||||
self.current_item = Some(i.span);
|
||||
let body_id = self.lower_maybe_async_body(
|
||||
@ -1302,7 +1312,10 @@ fn lower_maybe_async_body(
|
||||
this.expr_block(P(body), AttrVec::new())
|
||||
});
|
||||
|
||||
(this.arena.alloc_from_iter(parameters), this.expr(body_span, async_expr, AttrVec::new()))
|
||||
(
|
||||
this.arena.alloc_from_iter(parameters),
|
||||
this.expr(body_span, async_expr, AttrVec::new()),
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -996,7 +996,11 @@ fn check_item(&mut self, cx: &LateContext<'_, '_>, item: &hir::Item<'_>) {
|
||||
self.perform_lint(cx, "item", item.hir_id, &item.vis, item.span, true);
|
||||
}
|
||||
|
||||
fn check_foreign_item(&mut self, cx: &LateContext<'_, '_>, foreign_item: &hir::ForeignItem<'tcx>) {
|
||||
fn check_foreign_item(
|
||||
&mut self,
|
||||
cx: &LateContext<'_, '_>,
|
||||
foreign_item: &hir::ForeignItem<'tcx>,
|
||||
) {
|
||||
self.perform_lint(cx, "item", foreign_item.hir_id, &foreign_item.vis,
|
||||
foreign_item.span, true);
|
||||
}
|
||||
|
@ -246,7 +246,13 @@ fn is_snake_case(ident: &str) -> bool {
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSnakeCase {
|
||||
fn check_mod(&mut self, cx: &LateContext<'_, '_>, _: &'tcx hir::Mod<'tcx>, _: Span, id: hir::HirId) {
|
||||
fn check_mod(
|
||||
&mut self,
|
||||
cx: &LateContext<'_, '_>,
|
||||
_: &'tcx hir::Mod<'tcx>,
|
||||
_: Span,
|
||||
id: hir::HirId,
|
||||
) {
|
||||
if id != hir::CRATE_HIR_ID {
|
||||
return;
|
||||
}
|
||||
|
@ -2435,7 +2435,12 @@ fn check_transparent(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
|
||||
}
|
||||
|
||||
#[allow(trivial_numeric_casts)]
|
||||
pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant<'tcx>], id: hir::HirId) {
|
||||
pub fn check_enum<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
sp: Span,
|
||||
vs: &'tcx [hir::Variant<'tcx>],
|
||||
id: hir::HirId,
|
||||
) {
|
||||
let def_id = tcx.hir().local_def_id(id);
|
||||
let def = tcx.adt_def(def_id);
|
||||
def.destructor(tcx); // force the destructor to be evaluated
|
||||
|
@ -32,7 +32,9 @@
|
||||
// resolve_type_vars_in_body, which creates a new TypeTables which
|
||||
// doesn't contain any inference types.
|
||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>) -> &'tcx ty::TypeckTables<'tcx> {
|
||||
pub fn resolve_type_vars_in_body(&self, body: &'tcx hir::Body<'tcx>)
|
||||
-> &'tcx ty::TypeckTables<'tcx>
|
||||
{
|
||||
let item_id = self.tcx.hir().body_owner(body.id());
|
||||
let item_def_id = self.tcx.hir().local_def_id(item_id);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user