Rollup merge of #62019 - jeremystucki:refactoring, r=estebank
Remove needless lifetimes
This commit is contained in:
commit
64e5818307
6 changed files with 25 additions and 25 deletions
|
|
@ -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");
|
||||
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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[..]
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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> {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
|
@ -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| {
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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 {
|
||||
|
|
@ -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);
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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(|| {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue