Remove needless lifetimes

This commit is contained in:
Jeremy Stucki 2019-06-21 18:12:39 +02:00 committed by Jeremy Stucki
parent 87e8613fd4
commit 0477e07272
No known key found for this signature in database
GPG Key ID: 8F548A5A2ED13F58
17 changed files with 38 additions and 38 deletions

View File

@ -4,7 +4,7 @@ use crate::hir::itemlikevisit::ItemLikeVisitor;
use rustc_data_structures::fx::FxHashSet;
use rustc_data_structures::sync::{Lock, ParallelIterator, par_iter};
pub fn check_crate<'hir>(hir_map: &hir::map::Map<'hir>) {
pub fn check_crate(hir_map: &hir::map::Map<'_>) {
hir_map.dep_graph.assert_ignored();
let errors = Lock::new(Vec::new());

View File

@ -147,7 +147,7 @@ impl Forest {
}
}
pub fn krate<'hir>(&'hir self) -> &'hir Crate {
pub fn krate(&self) -> &Crate {
self.dep_graph.read(DepNode::new_no_params(DepKind::Krate));
&self.krate
}
@ -155,7 +155,7 @@ impl Forest {
/// This is used internally in the dependency tracking system.
/// Use the `krate` method to ensure your dependency on the
/// crate is tracked.
pub fn untracked_krate<'hir>(&'hir self) -> &'hir Crate {
pub fn untracked_krate(&self) -> &Crate {
&self.krate
}
}
@ -1085,7 +1085,7 @@ impl<'a> NodesMatchingSuffix<'a> {
// If `id` itself is a mod named `m` with parent `p`, then
// returns `Some(id, m, p)`. If `id` has no mod in its parent
// chain, then returns `None`.
fn find_first_mod_parent<'a>(map: &'a Map<'_>, mut id: HirId) -> Option<(HirId, Name)> {
fn find_first_mod_parent(map: &Map<'_>, mut id: HirId) -> Option<(HirId, Name)> {
loop {
if let Node::Item(item) = map.find(id)? {
if item_is_mod(&item) {

View File

@ -48,8 +48,8 @@ pub fn add_placeholder_note(err: &mut errors::DiagnosticBuilder<'_>) {
/// If there are types that satisfy both impls, invokes `on_overlap`
/// with a suitably-freshened `ImplHeader` with those types
/// substituted. Otherwise, invokes `no_overlap`.
pub fn overlapping_impls<'tcx, F1, F2, R>(
tcx: TyCtxt<'tcx>,
pub fn overlapping_impls<F1, F2, R>(
tcx: TyCtxt<'_>,
impl1_def_id: DefId,
impl2_def_id: DefId,
intercrate_mode: IntercrateMode,
@ -247,10 +247,10 @@ pub enum OrphanCheckErr<'tcx> {
///
/// 1. All type parameters in `Self` must be "covered" by some local type constructor.
/// 2. Some local type must appear in `Self`.
pub fn orphan_check<'tcx>(
tcx: TyCtxt<'tcx>,
pub fn orphan_check(
tcx: TyCtxt<'_>,
impl_def_id: DefId,
) -> Result<(), OrphanCheckErr<'tcx>> {
) -> Result<(), OrphanCheckErr<'_>> {
debug!("orphan_check({:?})", impl_def_id);
// We only except this routine to be invoked on implementations

View File

@ -247,7 +247,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
fn fuzzy_match_tys(&self, a: Ty<'tcx>, b: Ty<'tcx>) -> bool {
/// returns the fuzzy category of a given type, or None
/// if the type can be equated to any type.
fn type_category<'tcx>(t: Ty<'tcx>) -> Option<u32> {
fn type_category(t: Ty<'_>) -> Option<u32> {
match t.sty {
ty::Bool => Some(0),
ty::Char => Some(1),

View File

@ -702,6 +702,6 @@ impl<'tcx> TyCtxt<'tcx> {
}
}
pub(super) fn is_object_safe_provider<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId) -> bool {
pub(super) fn is_object_safe_provider(tcx: TyCtxt<'_>, trait_def_id: DefId) -> bool {
tcx.object_safety_violations(trait_def_id).is_empty()
}

View File

@ -1509,8 +1509,8 @@ fn confirm_impl_candidate<'cx, 'tcx>(
///
/// Based on the "projection mode", this lookup may in fact only examine the
/// topmost impl. See the comments for `Reveal` for more details.
fn assoc_ty_def<'cx, 'tcx>(
selcx: &SelectionContext<'cx, 'tcx>,
fn assoc_ty_def(
selcx: &SelectionContext<'_, '_>,
impl_def_id: DefId,
assoc_ty_def_id: DefId,
) -> specialization_graph::NodeItem<ty::AssocItem> {

View File

@ -417,7 +417,7 @@ pub struct SupertraitDefIds<'tcx> {
visited: FxHashSet<DefId>,
}
pub fn supertrait_def_ids<'tcx>(tcx: TyCtxt<'tcx>, trait_def_id: DefId) -> SupertraitDefIds<'tcx> {
pub fn supertrait_def_ids(tcx: TyCtxt<'_>, trait_def_id: DefId) -> SupertraitDefIds<'_> {
SupertraitDefIds {
tcx,
stack: vec![trait_def_id],

View File

@ -44,7 +44,7 @@ pub trait ExtraBackendMethods: CodegenBackend + WriteBackendMethods + Sized + Se
mods: &mut Self::Module,
kind: AllocatorKind,
);
fn compile_codegen_unit<'tcx>(&self, tcx: TyCtxt<'tcx>, cgu_name: InternedString);
fn compile_codegen_unit(&self, tcx: TyCtxt<'_>, cgu_name: InternedString);
// If find_features is true this won't access `sess.crate_types` by assuming
// that `is_pie_binary` is false. When we discover LLVM target features
// `sess.crate_types` is uninitialized so we cannot access it.

View File

@ -36,7 +36,7 @@ pub trait BuilderMethods<'a, 'tcx>:
{
fn new_block<'b>(cx: &'a Self::CodegenCx, llfn: Self::Value, name: &'b str) -> Self;
fn with_cx(cx: &'a Self::CodegenCx) -> Self;
fn build_sibling_block<'b>(&self, name: &'b str) -> Self;
fn build_sibling_block(&self, name: &str) -> Self;
fn cx(&self) -> &Self::CodegenCx;
fn llbb(&self) -> Self::BasicBlock;

View File

@ -14,8 +14,8 @@ pub struct AddRetag;
/// after the assignment, we can be sure to obtain the same place value.
/// (Concurrent accesses by other threads are no problem as these are anyway non-atomic
/// copies. Data races are UB.)
fn is_stable<'tcx>(
place: &Place<'tcx>,
fn is_stable(
place: &Place<'_>,
) -> bool {
use rustc::mir::Place::*;

View File

@ -480,11 +480,11 @@ impl<'a, 'tcx> hir::intravisit::Visitor<'tcx> for UnusedUnsafeVisitor<'a> {
}
}
fn check_unused_unsafe<'a, 'tcx>(
tcx: TyCtxt<'tcx>,
fn check_unused_unsafe(
tcx: TyCtxt<'_>,
def_id: DefId,
used_unsafe: &FxHashSet<hir::HirId>,
unsafe_blocks: &'a mut Vec<(hir::HirId, bool)>,
unsafe_blocks: &mut Vec<(hir::HirId, bool)>,
) {
let body_id =
tcx.hir().as_local_hir_id(def_id).and_then(|hir_id| {
@ -506,7 +506,7 @@ fn check_unused_unsafe<'a, 'tcx>(
hir::intravisit::Visitor::visit_body(&mut visitor, body);
}
fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> UnsafetyCheckResult {
fn unsafety_check_result(tcx: TyCtxt<'_>, def_id: DefId) -> UnsafetyCheckResult {
debug!("unsafety_violations({:?})", def_id);
// N.B., this borrow is valid because all the consumers of
@ -545,7 +545,7 @@ fn unsafety_check_result<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> UnsafetyChec
}
}
fn unsafe_derive_on_repr_packed<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
fn unsafe_derive_on_repr_packed(tcx: TyCtxt<'_>, def_id: DefId) {
let lint_hir_id = tcx.hir().as_local_hir_id(def_id).unwrap_or_else(||
bug!("checking unsafety for non-local def id {:?}", def_id));
@ -602,7 +602,7 @@ fn report_unused_unsafe(tcx: TyCtxt<'_>, used_unsafe: &FxHashSet<hir::HirId>, id
db.emit();
}
fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<DefId> {
fn builtin_derive_def_id(tcx: TyCtxt<'_>, def_id: DefId) -> Option<DefId> {
debug!("builtin_derive_def_id({:?})", def_id);
if let Some(impl_def_id) = tcx.impl_of_method(def_id) {
if tcx.has_attr(impl_def_id, sym::automatically_derived) {
@ -618,7 +618,7 @@ fn builtin_derive_def_id<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Option<DefId
}
}
pub fn check_unsafety<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
pub fn check_unsafety(tcx: TyCtxt<'_>, def_id: DefId) {
debug!("check_unsafety({:?})", def_id);
// closures are handled by their parent fn.

View File

@ -14,7 +14,7 @@ use crate::util as mir_util;
pub struct Marker(pub &'static str);
impl MirPass for Marker {
fn name<'a>(&'a self) -> Cow<'a, str> {
fn name(&self) -> Cow<'_, str> {
Cow::Borrowed(self.0)
}
@ -52,7 +52,7 @@ pub fn on_mir_pass<'tcx>(
}
}
pub fn emit_mir<'tcx>(tcx: TyCtxt<'tcx>, outputs: &OutputFilenames) -> io::Result<()> {
pub fn emit_mir(tcx: TyCtxt<'_>, outputs: &OutputFilenames) -> io::Result<()> {
let path = outputs.path(OutputType::Mir);
let mut f = File::create(&path)?;
mir_util::write_mir_pretty(tcx, None, &mut f)?;

View File

@ -1028,14 +1028,14 @@ fn create_generator_resume_function<'tcx>(
dump_mir(tcx, None, "generator_resume", &0, source, body, |_, _| Ok(()) );
}
fn source_info<'tcx>(body: &Body<'tcx>) -> SourceInfo {
fn source_info(body: &Body<'_>) -> SourceInfo {
SourceInfo {
span: body.span,
scope: OUTERMOST_SOURCE_SCOPE,
}
}
fn insert_clean_drop<'tcx>(body: &mut Body<'tcx>) -> BasicBlock {
fn insert_clean_drop(body: &mut Body<'_>) -> BasicBlock {
let return_block = insert_term_block(body, TerminatorKind::Return);
// Create a block to destroy an unresumed generators. This can only destroy upvars.

View File

@ -50,13 +50,13 @@ pub(crate) fn provide(providers: &mut Providers<'_>) {
};
}
fn is_mir_available<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool {
fn is_mir_available(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.mir_keys(def_id.krate).contains(&def_id)
}
/// Finds the full set of `DefId`s within the current crate that have
/// MIR associated with them.
fn mir_keys<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx DefIdSet {
fn mir_keys(tcx: TyCtxt<'_>, krate: CrateNum) -> &DefIdSet {
assert_eq!(krate, LOCAL_CRATE);
let mut set = DefIdSet::default();
@ -94,7 +94,7 @@ fn mir_keys<'tcx>(tcx: TyCtxt<'tcx>, krate: CrateNum) -> &'tcx DefIdSet {
tcx.arena.alloc(set)
}
fn mir_built<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Steal<Body<'tcx>> {
fn mir_built(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
let mir = build::mir_build(tcx, def_id);
tcx.alloc_steal_mir(mir)
}
@ -137,7 +137,7 @@ pub fn default_name<T: ?Sized>() -> Cow<'static, str> {
/// pass will be named after the type, and it will consist of a main
/// loop that goes over each available MIR and applies `run_pass`.
pub trait MirPass {
fn name<'a>(&'a self) -> Cow<'a, str> {
fn name(&self) -> Cow<'_, str> {
default_name::<Self>()
}
@ -192,7 +192,7 @@ pub fn run_passes(
}
}
fn mir_const<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Steal<Body<'tcx>> {
fn mir_const(tcx: TyCtxt<'_>, def_id: DefId) -> &Steal<Body<'_>> {
// Unsafety check uses the raw mir, so make sure it is run
let _ = tcx.unsafety_check_result(def_id);
@ -223,7 +223,7 @@ fn mir_validated(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Steal<Body<'tcx>> {
tcx.alloc_steal_mir(body)
}
fn optimized_mir<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> &'tcx Body<'tcx> {
fn optimized_mir(tcx: TyCtxt<'_>, def_id: DefId) -> &Body<'_> {
if tcx.is_constructor(def_id) {
// There's no reason to run all of the MIR passes on constructors when
// we can just output the MIR we want directly. This also saves const

View File

@ -1473,7 +1473,7 @@ pub fn provide(providers: &mut Providers<'_>) {
};
}
fn mir_const_qualif<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> (u8, &'tcx BitSet<Local>) {
fn mir_const_qualif(tcx: TyCtxt<'_>, def_id: DefId) -> (u8, &BitSet<Local>) {
// N.B., this `borrow()` is guaranteed to be valid (i.e., the value
// cannot yet be stolen), because `mir_validated()`, which steals
// from `mir_const(), forces this query to execute before

View File

@ -53,7 +53,7 @@ pub fn simplify_cfg(body: &mut Body<'_>) {
}
impl MirPass for SimplifyCfg {
fn name<'a>(&'a self) -> Cow<'a, str> {
fn name(&self) -> Cow<'_, str> {
Cow::Borrowed(&self.label)
}

View File

@ -15,7 +15,7 @@ impl SimplifyBranches {
}
impl MirPass for SimplifyBranches {
fn name<'a>(&'a self) -> Cow<'a, str> {
fn name(&self) -> Cow<'_, str> {
Cow::Borrowed(&self.label)
}