Skip to content

Commit

Permalink
Rollup merge of #62019 - jeremystucki:refactoring, r=estebank
Browse files Browse the repository at this point in the history
Remove needless lifetimes
  • Loading branch information
Centril committed Jun 21, 2019
2 parents 595f55c + 004efa2 commit 64e5818
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions src/librustc/ty/constness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ impl<'tcx> TyCtxt<'tcx> {
}


pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
pub fn provide(providers: &mut Providers<'_>) {
/// only checks whether the function has a `const` modifier
fn is_const_fn_raw<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
fn is_const_fn_raw(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
let hir_id = tcx.hir().as_local_hir_id(def_id)
.expect("Non-local call to local provider is_const_fn");

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

fn is_promotable_const_fn<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
fn is_promotable_const_fn(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.is_const_fn(def_id) && match tcx.lookup_stability(def_id) {
Some(stab) => {
if cfg!(debug_assertions) && stab.promotable {
Expand All @@ -101,7 +101,7 @@ pub fn provide<'tcx>(providers: &mut Providers<'tcx>) {
}
}

fn const_fn_is_allowed_fn_ptr<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
fn const_fn_is_allowed_fn_ptr(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.is_const_fn(def_id) &&
tcx.lookup_stability(def_id)
.map(|stab| stab.allow_const_fn_ptr).unwrap_or(false)
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2223,7 +2223,7 @@ impl<'tcx> Borrow<[Ty<'tcx>]> for Interned<'tcx, List<Ty<'tcx>>> {
}

impl<'tcx> Borrow<[CanonicalVarInfo]> for Interned<'tcx, List<CanonicalVarInfo>> {
fn borrow<'a>(&'a self) -> &'a [CanonicalVarInfo] {
fn borrow(&self) -> &[CanonicalVarInfo] {
&self.0[..]
}
}
Expand All @@ -2236,13 +2236,13 @@ impl<'tcx> Borrow<[Kind<'tcx>]> for Interned<'tcx, InternalSubsts<'tcx>> {

impl<'tcx> Borrow<[ProjectionKind]>
for Interned<'tcx, List<ProjectionKind>> {
fn borrow<'a>(&'a self) -> &'a [ProjectionKind] {
fn borrow(&self) -> &[ProjectionKind] {
&self.0[..]
}
}

impl<'tcx> Borrow<RegionKind> for Interned<'tcx, RegionKind> {
fn borrow<'a>(&'a self) -> &'a RegionKind {
fn borrow(&self) -> &RegionKind {
&self.0
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/ty/fast_reject.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ pub enum SimplifiedTypeGen<D>
/// then we can't say much about whether two types would unify. Put another way,
/// `can_simplify_params` should be true if type parameters appear free in `ty` and `false` if they
/// are to be considered bound.
pub fn simplify_type<'tcx>(
tcx: TyCtxt<'tcx>,
pub fn simplify_type(
tcx: TyCtxt<'_>,
ty: Ty<'_>,
can_simplify_params: bool,
) -> Option<SimplifiedType> {
Expand Down
24 changes: 12 additions & 12 deletions src/librustc/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ impl AssocItem {
}
}

pub fn signature<'tcx>(&self, tcx: TyCtxt<'tcx>) -> String {
pub fn signature(&self, tcx: TyCtxt<'_>) -> String {
match self.kind {
ty::AssocKind::Method => {
// We skip the binder here because the binder would deanonymize all
Expand Down Expand Up @@ -2311,7 +2311,7 @@ impl<'tcx> AdtDef {
/// Returns an iterator over all fields contained
/// by this ADT.
#[inline]
pub fn all_fields<'s>(&'s self) -> impl Iterator<Item = &'s FieldDef> + Clone {
pub fn all_fields(&self) -> impl Iterator<Item=&FieldDef> + Clone {
self.variants.iter().flat_map(|v| v.fields.iter())
}

Expand Down Expand Up @@ -3111,7 +3111,7 @@ impl Iterator for AssocItemsIterator<'_> {
}
}

fn associated_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AssocItem {
fn associated_item(tcx: TyCtxt<'_>, def_id: DefId) -> AssocItem {
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
let parent_id = tcx.hir().get_parent_item(id);
let parent_def_id = tcx.hir().local_def_id_from_hir_id(parent_id);
Expand Down Expand Up @@ -3156,7 +3156,7 @@ pub struct AdtSizedConstraint<'tcx>(pub &'tcx [Ty<'tcx>]);
/// such.
/// - a Error, if a type contained itself. The representability
/// check should catch this case.
fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConstraint<'tcx> {
fn adt_sized_constraint(tcx: TyCtxt<'_>, def_id: DefId) -> AdtSizedConstraint<'_> {
let def = tcx.adt_def(def_id);

let result = tcx.mk_type_list(def.variants.iter().flat_map(|v| {
Expand All @@ -3170,7 +3170,7 @@ fn adt_sized_constraint<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> AdtSizedConst
AdtSizedConstraint(result)
}

fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [DefId] {
fn associated_item_def_ids(tcx: TyCtxt<'_>, def_id: DefId) -> &[DefId] {
let id = tcx.hir().as_local_hir_id(def_id).unwrap();
let item = tcx.hir().expect_item(id);
match item.node {
Expand All @@ -3193,14 +3193,14 @@ fn associated_item_def_ids<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx [Def
}
}

fn def_span<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Span {
fn def_span(tcx: TyCtxt<'_>, def_id: DefId) -> Span {
tcx.hir().span_if_local(def_id).unwrap()
}

/// If the given `DefId` describes an item belonging to a trait,
/// returns the `DefId` of the trait that the trait item belongs to;
/// otherwise, returns `None`.
fn trait_of_item<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<DefId> {
fn trait_of_item(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
tcx.opt_associated_item(def_id)
.and_then(|associated_item| {
match associated_item.container {
Expand All @@ -3223,7 +3223,7 @@ pub fn is_impl_trait_defn(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
}

/// See `ParamEnv` struct definition for details.
fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> {
fn param_env(tcx: TyCtxt<'_>, def_id: DefId) -> ParamEnv<'_> {
// The param_env of an impl Trait type is its defining function's param_env
if let Some(parent) = is_impl_trait_defn(tcx, def_id) {
return param_env(tcx, parent);
Expand Down Expand Up @@ -3258,17 +3258,17 @@ fn param_env<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> ParamEnv<'tcx> {
traits::normalize_param_env_or_error(tcx, def_id, unnormalized_env, cause)
}

fn crate_disambiguator<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> CrateDisambiguator {
fn crate_disambiguator(tcx: TyCtxt<'_>, crate_num: CrateNum) -> CrateDisambiguator {
assert_eq!(crate_num, LOCAL_CRATE);
tcx.sess.local_crate_disambiguator()
}

fn original_crate_name<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Symbol {
fn original_crate_name(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Symbol {
assert_eq!(crate_num, LOCAL_CRATE);
tcx.crate_name.clone()
}

fn crate_hash<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) -> Svh {
fn crate_hash(tcx: TyCtxt<'_>, crate_num: CrateNum) -> Svh {
assert_eq!(crate_num, LOCAL_CRATE);
tcx.hir().crate_hash
}
Expand All @@ -3288,7 +3288,7 @@ fn instance_def_size_estimate<'tcx>(tcx: TyCtxt<'tcx>, instance_def: InstanceDef
/// If `def_id` is an issue 33140 hack impl, returns its self type; otherwise, returns `None`.
///
/// See [`ImplOverlapKind::Issue33140`] for more details.
fn issue33140_self_ty<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<Ty<'tcx>> {
fn issue33140_self_ty(tcx: TyCtxt<'_>, def_id: DefId) -> Option<Ty<'_>> {
debug!("issue33140_self_ty({:?})", def_id);

let trait_ref = tcx.impl_trait_ref(def_id).unwrap_or_else(|| {
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/ty/trait_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ impl<'tcx> TyCtxt<'tcx> {
}

// Query provider for `trait_impls_of`.
pub(super) fn trait_impls_of_provider<'tcx>(
tcx: TyCtxt<'tcx>,
pub(super) fn trait_impls_of_provider(
tcx: TyCtxt<'_>,
trait_id: DefId,
) -> &'tcx TraitImpls {
) -> &TraitImpls {
let mut impls = TraitImpls::default();

{
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/ty/walk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl<'tcx> Iterator for TypeWalker<'tcx> {
}
}

pub fn walk_shallow<'tcx>(ty: Ty<'tcx>) -> smallvec::IntoIter<TypeWalkerArray<'tcx>> {
pub fn walk_shallow(ty: Ty<'_>) -> smallvec::IntoIter<TypeWalkerArray<'_>> {
let mut stack = SmallVec::new();
push_subtypes(&mut stack, ty);
stack.into_iter()
Expand Down

0 comments on commit 64e5818

Please sign in to comment.