Skip to content

Commit

Permalink
Remove needless lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystucki committed Jul 3, 2019
1 parent 6ae80cf commit d50a3a7
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 66 deletions.
2 changes: 1 addition & 1 deletion src/librustc/hir/check_attr.rs
Expand Up @@ -347,7 +347,7 @@ fn is_c_like_enum(item: &hir::Item) -> bool {
}
}

fn check_mod_attrs<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(
module_def_id,
&mut CheckAttrVisitor { tcx }.as_deep_visitor()
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/infer/type_variable.rs
Expand Up @@ -115,7 +115,7 @@ impl<'tcx> TypeVariableTable<'tcx> {
///
/// Note that this function does not return care whether
/// `vid` has been unified with something else or not.
pub fn var_diverges<'a>(&'a self, vid: ty::TyVid) -> bool {
pub fn var_diverges(&self, vid: ty::TyVid) -> bool {
self.values.get(vid.index as usize).diverging
}

Expand Down
6 changes: 3 additions & 3 deletions src/librustc_data_structures/graph/implementation/mod.rs
Expand Up @@ -247,11 +247,11 @@ impl<N: Debug, E: Debug> Graph<N, E> {
self.incoming_edges(target).sources()
}

pub fn depth_traverse<'a>(
&'a self,
pub fn depth_traverse(
&self,
start: NodeIndex,
direction: Direction,
) -> DepthFirstTraversal<'a, N, E> {
) -> DepthFirstTraversal<'_, N, E> {
DepthFirstTraversal::with_start_node(self, start, direction)
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_mir/dataflow/impls/borrowed_locals.rs
Expand Up @@ -92,7 +92,7 @@ struct BorrowedLocalsVisitor<'gk> {
trans: &'gk mut GenKillSet<Local>,
}

fn find_local<'tcx>(place: &Place<'tcx>) -> Option<Local> {
fn find_local(place: &Place<'_>) -> Option<Local> {
place.iterate(|place_base, place_projection| {
for proj in place_projection {
if proj.elem == ProjectionElem::Deref {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_typeck/check/dropck.rs
Expand Up @@ -29,7 +29,7 @@ use syntax_pos::Span;
/// struct/enum definition for the nominal type itself (i.e.
/// cannot do `struct S<T>; impl<T:Clone> Drop for S<T> { ... }`).
///
pub fn check_drop_impl<'tcx>(tcx: TyCtxt<'tcx>, drop_impl_did: DefId) -> Result<(), ErrorReported> {
pub fn check_drop_impl(tcx: TyCtxt<'_>, drop_impl_did: DefId) -> Result<(), ErrorReported> {
let dtor_self_type = tcx.type_of(drop_impl_did);
let dtor_predicates = tcx.predicates_of(drop_impl_did);
match dtor_self_type.sty {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_typeck/check/intrinsic.rs
Expand Up @@ -79,7 +79,7 @@ pub fn intrisic_operation_unsafety(intrinsic: &str) -> hir::Unsafety {

/// Remember to add all intrinsics here, in librustc_codegen_llvm/intrinsic.rs,
/// and in libcore/intrinsics.rs
pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx>, it: &hir::ForeignItem) {
pub fn check_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem) {
let param = |n| tcx.mk_ty_param(n, InternedString::intern(&format!("P{}", n)));
let name = it.ident.as_str();

Expand Down Expand Up @@ -385,7 +385,7 @@ pub fn check_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx>, it: &hir::ForeignItem) {
}

/// Type-check `extern "platform-intrinsic" { ... }` functions.
pub fn check_platform_intrinsic_type<'tcx>(tcx: TyCtxt<'tcx>, it: &hir::ForeignItem) {
pub fn check_platform_intrinsic_type(tcx: TyCtxt<'_>, it: &hir::ForeignItem) {
let param = |n| {
let name = InternedString::intern(&format!("P{}", n));
tcx.mk_ty_param(n, name)
Expand Down
50 changes: 25 additions & 25 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -698,31 +698,31 @@ impl ItemLikeVisitor<'tcx> for CheckItemTypesVisitor<'tcx> {
fn visit_impl_item(&mut self, _: &'tcx hir::ImplItem) { }
}

pub fn check_wf_new<'tcx>(tcx: TyCtxt<'tcx>) {
pub fn check_wf_new(tcx: TyCtxt<'_>) {
let mut visit = wfcheck::CheckTypeWellFormedVisitor::new(tcx);
tcx.hir().krate().par_visit_all_item_likes(&mut visit);
}

fn check_mod_item_types<'tcx>(tcx: TyCtxt<'tcx>, module_def_id: DefId) {
fn check_mod_item_types(tcx: TyCtxt<'_>, module_def_id: DefId) {
tcx.hir().visit_item_likes_in_module(module_def_id, &mut CheckItemTypesVisitor { tcx });
}

fn typeck_item_bodies<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) {
fn typeck_item_bodies(tcx: TyCtxt<'_>, crate_num: CrateNum) {
debug_assert!(crate_num == LOCAL_CRATE);
tcx.par_body_owners(|body_owner_def_id| {
tcx.ensure().typeck_tables_of(body_owner_def_id);
});
}

fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
wfcheck::check_item_well_formed(tcx, def_id);
}

fn check_trait_item_well_formed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
fn check_trait_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
wfcheck::check_trait_item(tcx, def_id);
}

fn check_impl_item_well_formed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
fn check_impl_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
wfcheck::check_impl_item(tcx, def_id);
}

Expand All @@ -742,7 +742,7 @@ pub fn provide(providers: &mut Providers<'_>) {
};
}

fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<ty::Destructor> {
fn adt_destructor(tcx: TyCtxt<'_>, def_id: DefId) -> Option<ty::Destructor> {
tcx.calculate_dtor(def_id, &mut dropck::check_drop_impl)
}

Expand All @@ -755,10 +755,10 @@ fn adt_destructor<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<ty::Destruct
/// may not succeed. In some cases where this function returns `None`
/// (notably closures), `typeck_tables(def_id)` would wind up
/// redirecting to the owning function.
fn primary_body_of<'tcx>(
tcx: TyCtxt<'tcx>,
fn primary_body_of(
tcx: TyCtxt<'_>,
id: hir::HirId,
) -> Option<(hir::BodyId, Option<&'tcx hir::FnDecl>)> {
) -> Option<(hir::BodyId, Option<&hir::FnDecl>)> {
match tcx.hir().get(id) {
Node::Item(item) => {
match item.node {
Expand Down Expand Up @@ -796,7 +796,7 @@ fn primary_body_of<'tcx>(
}
}

fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
fn has_typeck_tables(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
// Closures' tables come from their outermost function,
// as they are part of the same "inference environment".
let outer_def_id = tcx.closure_base_def_id(def_id);
Expand All @@ -808,11 +808,11 @@ fn has_typeck_tables<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
primary_body_of(tcx, id).is_some()
}

fn used_trait_imports<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx DefIdSet {
fn used_trait_imports(tcx: TyCtxt<'_>, def_id: DefId) -> &DefIdSet {
&*tcx.typeck_tables_of(def_id).used_trait_imports
}

fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::TypeckTables<'tcx> {
fn typeck_tables_of(tcx: TyCtxt<'_>, def_id: DefId) -> &ty::TypeckTables<'_> {
// Closures' tables come from their outermost function,
// as they are part of the same "inference environment".
let outer_def_id = tcx.closure_base_def_id(def_id);
Expand Down Expand Up @@ -913,7 +913,7 @@ fn typeck_tables_of<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx ty::TypeckT
tables
}

fn check_abi<'tcx>(tcx: TyCtxt<'tcx>, span: Span, abi: Abi) {
fn check_abi(tcx: TyCtxt<'_>, span: Span, abi: Abi) {
if !tcx.sess.target.target.is_abi_supported(abi) {
struct_span_err!(tcx.sess, span, E0570,
"The ABI `{}` is not supported for the current target", abi).emit()
Expand Down Expand Up @@ -1291,7 +1291,7 @@ fn check_fn<'a, 'tcx>(
(fcx, gen_ty)
}

fn check_struct<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId, span: Span) {
fn check_struct(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) {
let def_id = tcx.hir().local_def_id_from_hir_id(id);
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated
Expand All @@ -1305,7 +1305,7 @@ fn check_struct<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId, span: Span) {
check_packed(tcx, span, def_id);
}

fn check_union<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId, span: Span) {
fn check_union(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) {
let def_id = tcx.hir().local_def_id_from_hir_id(id);
let def = tcx.adt_def(def_id);
def.destructor(tcx); // force the destructor to be evaluated
Expand Down Expand Up @@ -1467,14 +1467,14 @@ fn maybe_check_static_with_link_section(tcx: TyCtxt<'_>, id: DefId, span: Span)
}
}

fn check_on_unimplemented<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId, item: &hir::Item) {
fn check_on_unimplemented(tcx: TyCtxt<'_>, trait_def_id: DefId, item: &hir::Item) {
let item_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
// an error would be reported if this fails.
let _ = traits::OnUnimplementedDirective::of_item(tcx, trait_def_id, item_def_id);
}

fn report_forbidden_specialization<'tcx>(
tcx: TyCtxt<'tcx>,
fn report_forbidden_specialization(
tcx: TyCtxt<'_>,
impl_item: &hir::ImplItem,
parent_impl: DefId,
) {
Expand Down Expand Up @@ -1690,7 +1690,7 @@ fn check_impl_items_against_trait<'tcx>(
/// Checks whether a type can be represented in memory. In particular, it
/// identifies types that contain themselves without indirection through a
/// pointer, which would mean their size is unbounded.
fn check_representable<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, item_def_id: DefId) -> bool {
fn check_representable(tcx: TyCtxt<'_>, sp: Span, item_def_id: DefId) -> bool {
let rty = tcx.type_of(item_def_id);

// Check that it is possible to represent this type. This call identifies
Expand All @@ -1712,7 +1712,7 @@ fn check_representable<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, item_def_id: DefId) ->
return true;
}

pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, def_id: DefId) {
pub fn check_simd(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
let t = tcx.type_of(def_id);
if let ty::Adt(def, substs) = t.sty {
if def.is_struct() {
Expand Down Expand Up @@ -1741,7 +1741,7 @@ pub fn check_simd<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, def_id: DefId) {
}
}

fn check_packed<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, def_id: DefId) {
fn check_packed(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
let repr = tcx.adt_def(def_id).repr;
if repr.packed() {
for attr in tcx.get_attrs(def_id).iter() {
Expand All @@ -1765,7 +1765,7 @@ fn check_packed<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, def_id: DefId) {
}
}

fn check_packed_inner<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, stack: &mut Vec<DefId>) -> bool {
fn check_packed_inner(tcx: TyCtxt<'_>, def_id: DefId, stack: &mut Vec<DefId>) -> bool {
let t = tcx.type_of(def_id);
if stack.contains(&def_id) {
debug!("check_packed_inner: {:?} is recursive", t);
Expand Down Expand Up @@ -1839,7 +1839,7 @@ fn bad_non_zero_sized_fields<'tcx>(
err.emit();
}

fn check_transparent<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, def_id: DefId) {
fn check_transparent(tcx: TyCtxt<'_>, sp: Span, def_id: DefId) {
let adt = tcx.adt_def(def_id);
if !adt.repr.transparent() {
return;
Expand Down Expand Up @@ -1988,7 +1988,7 @@ pub fn check_enum<'tcx>(tcx: TyCtxt<'tcx>, sp: Span, vs: &'tcx [hir::Variant], i
check_transparent(tcx, sp, def_id);
}

fn report_unexpected_variant_res<'tcx>(tcx: TyCtxt<'tcx>, res: Res, span: Span, qpath: &QPath) {
fn report_unexpected_variant_res(tcx: TyCtxt<'_>, res: Res, span: Span, qpath: &QPath) {
span_err!(tcx.sess, span, E0533,
"expected unit struct/variant or constant, found {} `{}`",
res.descr(),
Expand Down
30 changes: 15 additions & 15 deletions src/librustc_typeck/check/wfcheck.rs
Expand Up @@ -68,7 +68,7 @@ impl<'tcx> CheckWfFcxBuilder<'tcx> {
/// We do this check as a pre-pass before checking fn bodies because if these constraints are
/// not included it frequently leads to confusing errors in fn bodies. So it's better to check
/// the types first.
pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
pub fn check_item_well_formed(tcx: TyCtxt<'_>, def_id: DefId) {
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
let item = tcx.hir().expect_item(hir_id);

Expand Down Expand Up @@ -156,7 +156,7 @@ pub fn check_item_well_formed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
}
}

pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
pub fn check_trait_item(tcx: TyCtxt<'_>, def_id: DefId) {
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
let trait_item = tcx.hir().expect_trait_item(hir_id);

Expand All @@ -167,7 +167,7 @@ pub fn check_trait_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
check_associated_item(tcx, trait_item.hir_id, trait_item.span, method_sig);
}

pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
pub fn check_impl_item(tcx: TyCtxt<'_>, def_id: DefId) {
let hir_id = tcx.hir().as_local_hir_id(def_id).unwrap();
let impl_item = tcx.hir().expect_impl_item(hir_id);

Expand All @@ -178,8 +178,8 @@ pub fn check_impl_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
check_associated_item(tcx, impl_item.hir_id, impl_item.span, method_sig);
}

fn check_associated_item<'tcx>(
tcx: TyCtxt<'tcx>,
fn check_associated_item(
tcx: TyCtxt<'_>,
item_id: hir::HirId,
span: Span,
sig_if_method: Option<&hir::MethodSig>,
Expand Down Expand Up @@ -231,7 +231,7 @@ fn for_item<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) -> CheckWfFcxBuilder<'tcx
for_id(tcx, item.hir_id, item.span)
}

fn for_id<'tcx>(tcx: TyCtxt<'tcx>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'tcx> {
fn for_id(tcx: TyCtxt<'_>, id: hir::HirId, span: Span) -> CheckWfFcxBuilder<'_> {
let def_id = tcx.hir().local_def_id_from_hir_id(id);
CheckWfFcxBuilder {
inherited: Inherited::build(tcx, def_id),
Expand Down Expand Up @@ -317,7 +317,7 @@ fn check_type_defn<'tcx, F>(
});
}

fn check_trait<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) {
fn check_trait(tcx: TyCtxt<'_>, item: &hir::Item) {
debug!("check_trait: {:?}", item.hir_id);

let trait_def_id = tcx.hir().local_def_id_from_hir_id(item.hir_id);
Expand All @@ -340,7 +340,7 @@ fn check_trait<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) {
});
}

fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) {
fn check_item_fn(tcx: TyCtxt<'_>, item: &hir::Item) {
for_item(tcx, item).with_fcx(|fcx, tcx| {
let def_id = fcx.tcx.hir().local_def_id_from_hir_id(item.hir_id);
let sig = fcx.tcx.fn_sig(def_id);
Expand All @@ -352,8 +352,8 @@ fn check_item_fn<'tcx>(tcx: TyCtxt<'tcx>, item: &hir::Item) {
})
}

fn check_item_type<'tcx>(
tcx: TyCtxt<'tcx>,
fn check_item_type(
tcx: TyCtxt<'_>,
item_id: hir::HirId,
ty_span: Span,
allow_foreign_ty: bool,
Expand Down Expand Up @@ -980,7 +980,7 @@ fn check_variances_for_type_defn<'tcx>(
}
}

fn report_bivariance<'tcx>(tcx: TyCtxt<'tcx>, span: Span, param_name: ast::Name) {
fn report_bivariance(tcx: TyCtxt<'_>, span: Span, param_name: ast::Name) {
let mut err = error_392(tcx, span, param_name);

let suggested_marker_id = tcx.lang_items().phantom_data();
Expand Down Expand Up @@ -1023,7 +1023,7 @@ fn reject_shadowing_parameters(tcx: TyCtxt<'_>, def_id: DefId) {

/// Feature gates RFC 2056 -- trivial bounds, checking for global bounds that
/// aren't true.
fn check_false_global_bounds<'a, 'tcx>(fcx: &FnCtxt<'a, 'tcx>, span: Span, id: hir::HirId) {
fn check_false_global_bounds(fcx: &FnCtxt<'_, '_>, span: Span, id: hir::HirId) {
let empty_env = ty::ParamEnv::empty();

let def_id = fcx.tcx.hir().local_def_id_from_hir_id(id);
Expand Down Expand Up @@ -1135,11 +1135,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
}
}

fn error_392<'tcx>(
tcx: TyCtxt<'tcx>,
fn error_392(
tcx: TyCtxt<'_>,
span: Span,
param_name: ast::Name,
) -> DiagnosticBuilder<'tcx> {
) -> DiagnosticBuilder<'_> {
let mut err = struct_span_err!(tcx.sess, span, E0392,
"parameter `{}` is never used", param_name);
err.span_label(span, "unused parameter");
Expand Down
8 changes: 4 additions & 4 deletions src/librustc_typeck/coherence/builtin.rs
Expand Up @@ -17,7 +17,7 @@ use rustc::hir::def_id::DefId;
use hir::Node;
use rustc::hir::{self, ItemKind};

pub fn check_trait<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId) {
pub fn check_trait(tcx: TyCtxt<'_>, trait_def_id: DefId) {
Checker { tcx, trait_def_id }
.check(tcx.lang_items().drop_trait(), visit_implementation_of_drop)
.check(tcx.lang_items().copy_trait(), visit_implementation_of_copy)
Expand Down Expand Up @@ -46,7 +46,7 @@ impl<'tcx> Checker<'tcx> {
}
}

fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) {
fn visit_implementation_of_drop(tcx: TyCtxt<'_>, impl_did: DefId) {
if let ty::Adt(..) = tcx.type_of(impl_did).sty {
/* do nothing */
} else {
Expand Down Expand Up @@ -74,7 +74,7 @@ fn visit_implementation_of_drop<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) {
}
}

fn visit_implementation_of_copy<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) {
fn visit_implementation_of_copy(tcx: TyCtxt<'_>, impl_did: DefId) {
debug!("visit_implementation_of_copy: impl_did={:?}", impl_did);

let impl_hir_id = if let Some(n) = tcx.hir().as_local_hir_id(impl_did) {
Expand Down Expand Up @@ -154,7 +154,7 @@ fn visit_implementation_of_coerce_unsized(tcx: TyCtxt<'tcx>, impl_did: DefId) {
}
}

fn visit_implementation_of_dispatch_from_dyn<'tcx>(tcx: TyCtxt<'tcx>, impl_did: DefId) {
fn visit_implementation_of_dispatch_from_dyn(tcx: TyCtxt<'_>, impl_did: DefId) {
debug!("visit_implementation_of_dispatch_from_dyn: impl_did={:?}",
impl_did);
if impl_did.is_local() {
Expand Down

0 comments on commit d50a3a7

Please sign in to comment.