Remove needless lifetimes

This commit is contained in:
Jeremy Stucki 2019-06-21 18:51:27 +02:00 committed by Jeremy Stucki
parent 0477e07272
commit 6ae80cf23f
No known key found for this signature in database
GPG Key ID: 8F548A5A2ED13F58
19 changed files with 59 additions and 59 deletions

View File

@ -30,7 +30,7 @@ struct LoopScope {
break_index: CFGIndex, // where to go on a `break` break_index: CFGIndex, // where to go on a `break`
} }
pub fn construct<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG { pub fn construct(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
let mut graph = graph::Graph::new(); let mut graph = graph::Graph::new();
let entry = graph.add_node(CFGNodeData::Entry); let entry = graph.add_node(CFGNodeData::Entry);

View File

@ -49,7 +49,7 @@ pub type CFGNode = graph::Node<CFGNodeData>;
pub type CFGEdge = graph::Edge<CFGEdgeData>; pub type CFGEdge = graph::Edge<CFGEdgeData>;
impl CFG { impl CFG {
pub fn new<'tcx>(tcx: TyCtxt<'tcx>, body: &hir::Body) -> CFG { pub fn new(tcx: TyCtxt<'_>, body: &hir::Body) -> CFG {
construct::construct(tcx, body) construct::construct(tcx, body)
} }

View File

@ -841,7 +841,7 @@ impl DepGraph {
// //
// This method will only load queries that will end up in the disk cache. // This method will only load queries that will end up in the disk cache.
// Other queries will not be executed. // Other queries will not be executed.
pub fn exec_cache_promotions<'tcx>(&self, tcx: TyCtxt<'tcx>) { pub fn exec_cache_promotions(&self, tcx: TyCtxt<'_>) {
let data = self.data.as_ref().unwrap(); let data = self.data.as_ref().unwrap();
for prev_index in data.colors.values.indices() { for prev_index in data.colors.values.indices() {
match data.colors.get(prev_index) { match data.colors.get(prev_index) {

View File

@ -354,7 +354,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
cmt: &mc::cmt_<'tcx>, cmt: &mc::cmt_<'tcx>,
loan_region: ty::Region<'tcx>, loan_region: ty::Region<'tcx>,
borrow_span: Span) { borrow_span: Span) {
pub fn borrow_of_local_data<'tcx>(cmt: &mc::cmt_<'tcx>) -> bool { pub fn borrow_of_local_data(cmt: &mc::cmt_<'_>) -> bool {
match cmt.cat { match cmt.cat {
// Borrows of static items is allowed // Borrows of static items is allowed
Categorization::StaticItem => false, Categorization::StaticItem => false,

View File

@ -53,7 +53,7 @@ pub struct LoanDataFlowOperator;
pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>; pub type LoanDataFlow<'tcx> = DataFlowContext<'tcx, LoanDataFlowOperator>;
pub fn check_crate<'tcx>(tcx: TyCtxt<'tcx>) { pub fn check_crate(tcx: TyCtxt<'_>) {
tcx.par_body_owners(|body_owner_def_id| { tcx.par_body_owners(|body_owner_def_id| {
tcx.ensure().borrowck(body_owner_def_id); tcx.ensure().borrowck(body_owner_def_id);
}); });
@ -73,7 +73,7 @@ pub struct AnalysisData<'tcx> {
pub move_data: move_data::FlowedMoveData<'tcx>, pub move_data: move_data::FlowedMoveData<'tcx>,
} }
fn borrowck<'tcx>(tcx: TyCtxt<'tcx>, owner_def_id: DefId) -> &'tcx BorrowCheckResult { fn borrowck(tcx: TyCtxt<'_>, owner_def_id: DefId) -> &BorrowCheckResult {
assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck());
debug!("borrowck(body_owner_def_id={:?})", owner_def_id); debug!("borrowck(body_owner_def_id={:?})", owner_def_id);

View File

@ -239,9 +239,9 @@ impl<'a> Drop for DiagnosticHandlers<'a> {
} }
} }
unsafe extern "C" fn report_inline_asm<'a, 'b>(cgcx: &'a CodegenContext<LlvmCodegenBackend>, unsafe extern "C" fn report_inline_asm(cgcx: &CodegenContext<LlvmCodegenBackend>,
msg: &'b str, msg: &str,
cookie: c_uint) { cookie: c_uint) {
cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_owned()); cgcx.diag_emitter.inline_asm_error(cookie as u32, msg.to_owned());
} }

View File

@ -46,10 +46,10 @@ pub fn crates_export_threshold(crate_types: &[config::CrateType]) -> SymbolExpor
} }
} }
fn reachable_non_generics_provider<'tcx>( fn reachable_non_generics_provider(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
cnum: CrateNum, cnum: CrateNum,
) -> &'tcx DefIdMap<SymbolExportLevel> { ) -> &DefIdMap<SymbolExportLevel> {
assert_eq!(cnum, LOCAL_CRATE); assert_eq!(cnum, LOCAL_CRATE);
if !tcx.sess.opts.output_types.should_codegen() { if !tcx.sess.opts.output_types.should_codegen() {
@ -157,7 +157,7 @@ fn reachable_non_generics_provider<'tcx>(
tcx.arena.alloc(reachable_non_generics) tcx.arena.alloc(reachable_non_generics)
} }
fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { fn is_reachable_non_generic_provider_local(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
let export_threshold = threshold(tcx); let export_threshold = threshold(tcx);
if let Some(&level) = tcx.reachable_non_generics(def_id.krate).get(&def_id) { if let Some(&level) = tcx.reachable_non_generics(def_id.krate).get(&def_id) {
@ -167,14 +167,14 @@ fn is_reachable_non_generic_provider_local<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefI
} }
} }
fn is_reachable_non_generic_provider_extern<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> bool { fn is_reachable_non_generic_provider_extern(tcx: TyCtxt<'_>, def_id: DefId) -> bool {
tcx.reachable_non_generics(def_id.krate).contains_key(&def_id) tcx.reachable_non_generics(def_id.krate).contains_key(&def_id)
} }
fn exported_symbols_provider_local<'tcx>( fn exported_symbols_provider_local(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
cnum: CrateNum, cnum: CrateNum,
) -> Arc<Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)>> { ) -> Arc<Vec<(ExportedSymbol<'_>, SymbolExportLevel)>> {
assert_eq!(cnum, LOCAL_CRATE); assert_eq!(cnum, LOCAL_CRATE);
if !tcx.sess.opts.output_types.should_codegen() { if !tcx.sess.opts.output_types.should_codegen() {
@ -273,10 +273,10 @@ fn exported_symbols_provider_local<'tcx>(
Arc::new(symbols) Arc::new(symbols)
} }
fn upstream_monomorphizations_provider<'tcx>( fn upstream_monomorphizations_provider(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
cnum: CrateNum, cnum: CrateNum,
) -> &'tcx DefIdMap<FxHashMap<SubstsRef<'tcx>, CrateNum>> { ) -> &DefIdMap<FxHashMap<SubstsRef<'_>, CrateNum>> {
debug_assert!(cnum == LOCAL_CRATE); debug_assert!(cnum == LOCAL_CRATE);
let cnums = tcx.all_crate_nums(LOCAL_CRATE); let cnums = tcx.all_crate_nums(LOCAL_CRATE);
@ -322,10 +322,10 @@ fn upstream_monomorphizations_provider<'tcx>(
tcx.arena.alloc(instances) tcx.arena.alloc(instances)
} }
fn upstream_monomorphizations_for_provider<'tcx>( fn upstream_monomorphizations_for_provider(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
def_id: DefId, def_id: DefId,
) -> Option<&'tcx FxHashMap<SubstsRef<'tcx>, CrateNum>> { ) -> Option<&FxHashMap<SubstsRef<'_>, CrateNum>> {
debug_assert!(!def_id.is_local()); debug_assert!(!def_id.is_local());
tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id) tcx.upstream_monomorphizations(LOCAL_CRATE).get(&def_id)
} }

View File

@ -10,7 +10,7 @@ pub enum FunctionDebugContext<D> {
} }
impl<D> FunctionDebugContext<D> { impl<D> FunctionDebugContext<D> {
pub fn get_ref<'a>(&'a self, span: Span) -> &'a FunctionDebugContextData<D> { pub fn get_ref(&self, span: Span) -> &FunctionDebugContextData<D> {
match *self { match *self {
FunctionDebugContext::RegularContext(ref data) => data, FunctionDebugContext::RegularContext(ref data) => data,
FunctionDebugContext::DebugInfoDisabled => { FunctionDebugContext::DebugInfoDisabled => {

View File

@ -26,10 +26,10 @@ pub trait WithSuccessors: DirectedGraph
where where
Self: for<'graph> GraphSuccessors<'graph, Item = <Self as DirectedGraph>::Node>, Self: for<'graph> GraphSuccessors<'graph, Item = <Self as DirectedGraph>::Node>,
{ {
fn successors<'graph>( fn successors(
&'graph self, &self,
node: Self::Node, node: Self::Node,
) -> <Self as GraphSuccessors<'graph>>::Iter; ) -> <Self as GraphSuccessors<'_>>::Iter;
fn depth_first_search(&self, from: Self::Node) -> iterate::DepthFirstSearch<'_, Self> fn depth_first_search(&self, from: Self::Node) -> iterate::DepthFirstSearch<'_, Self>
where where
@ -48,10 +48,10 @@ pub trait WithPredecessors: DirectedGraph
where where
Self: for<'graph> GraphPredecessors<'graph, Item = <Self as DirectedGraph>::Node>, Self: for<'graph> GraphPredecessors<'graph, Item = <Self as DirectedGraph>::Node>,
{ {
fn predecessors<'graph>( fn predecessors(
&'graph self, &self,
node: Self::Node, node: Self::Node,
) -> <Self as GraphPredecessors<'graph>>::Iter; ) -> <Self as GraphPredecessors<'_>>::Iter;
} }
pub trait GraphPredecessors<'graph> { pub trait GraphPredecessors<'graph> {

View File

@ -17,15 +17,15 @@ impl<'graph, G: WithStartNode> WithStartNode for &'graph G {
} }
impl<'graph, G: WithSuccessors> WithSuccessors for &'graph G { impl<'graph, G: WithSuccessors> WithSuccessors for &'graph G {
fn successors<'iter>(&'iter self, node: Self::Node) -> <Self as GraphSuccessors<'iter>>::Iter { fn successors(&self, node: Self::Node) -> <Self as GraphSuccessors<'_>>::Iter {
(**self).successors(node) (**self).successors(node)
} }
} }
impl<'graph, G: WithPredecessors> WithPredecessors for &'graph G { impl<'graph, G: WithPredecessors> WithPredecessors for &'graph G {
fn predecessors<'iter>(&'iter self, fn predecessors(&self,
node: Self::Node) node: Self::Node)
-> <Self as GraphPredecessors<'iter>>::Iter { -> <Self as GraphPredecessors<'_>>::Iter {
(**self).predecessors(node) (**self).predecessors(node)
} }
} }

View File

@ -51,15 +51,15 @@ impl WithNumNodes for TestGraph {
} }
impl WithPredecessors for TestGraph { impl WithPredecessors for TestGraph {
fn predecessors<'graph>(&'graph self, fn predecessors(&self,
node: usize) node: usize)
-> <Self as GraphPredecessors<'graph>>::Iter { -> <Self as GraphPredecessors<'_>>::Iter {
self.predecessors[&node].iter().cloned() self.predecessors[&node].iter().cloned()
} }
} }
impl WithSuccessors for TestGraph { impl WithSuccessors for TestGraph {
fn successors<'graph>(&'graph self, node: usize) -> <Self as GraphSuccessors<'graph>>::Iter { fn successors(&self, node: usize) -> <Self as GraphSuccessors>::Iter {
self.successors[&node].iter().cloned() self.successors[&node].iter().cloned()
} }
} }

View File

@ -87,7 +87,7 @@ pub fn provide(providers: &mut Providers<'_>) {
}; };
} }
fn mir_borrowck<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> BorrowCheckResult<'tcx> { fn mir_borrowck(tcx: TyCtxt<'_>, def_id: DefId) -> BorrowCheckResult<'_> {
let input_body = tcx.mir_validated(def_id); let input_body = tcx.mir_validated(def_id);
debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id)); debug!("run query mir_borrowck: {}", tcx.def_path_str(def_id));

View File

@ -234,10 +234,10 @@ impl<'s, D: ConstraintGraphDirecton> graph::WithNumNodes for RegionGraph<'s, D>
} }
impl<'s, D: ConstraintGraphDirecton> graph::WithSuccessors for RegionGraph<'s, D> { impl<'s, D: ConstraintGraphDirecton> graph::WithSuccessors for RegionGraph<'s, D> {
fn successors<'graph>( fn successors(
&'graph self, &self,
node: Self::Node, node: Self::Node,
) -> <Self as graph::GraphSuccessors<'graph>>::Iter { ) -> <Self as graph::GraphSuccessors<'_>>::Iter {
self.outgoing_regions(node) self.outgoing_regions(node)
} }
} }

View File

@ -130,7 +130,7 @@ pub(super) fn is_active<'tcx>(
/// Determines if a given borrow is borrowing local data /// Determines if a given borrow is borrowing local data
/// This is called for all Yield statements on movable generators /// This is called for all Yield statements on movable generators
pub(super) fn borrow_of_local_data<'tcx>(place: &Place<'tcx>) -> bool { pub(super) fn borrow_of_local_data(place: &Place<'_>) -> bool {
place.iterate(|place_base, place_projection| { place.iterate(|place_base, place_projection| {
match place_base { match place_base {
PlaceBase::Static(..) => return false, PlaceBase::Static(..) => return false,

View File

@ -31,7 +31,7 @@ pub enum RvalueFunc {
/// Determines the category for a given expression. Note that scope /// Determines the category for a given expression. Note that scope
/// and paren expressions have no category. /// and paren expressions have no category.
impl Category { impl Category {
pub fn of<'tcx>(ek: &ExprKind<'tcx>) -> Option<Category> { pub fn of(ek: &ExprKind<'_>) -> Option<Category> {
match *ek { match *ek {
ExprKind::Scope { .. } => None, ExprKind::Scope { .. } => None,

View File

@ -22,7 +22,7 @@ use syntax_pos::Span;
use super::lints; use super::lints;
/// Construct the MIR for a given `DefId`. /// Construct the MIR for a given `DefId`.
pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Body<'tcx> { pub fn mir_build(tcx: TyCtxt<'_>, def_id: DefId) -> Body<'_> {
let id = tcx.hir().as_local_hir_id(def_id).unwrap(); let id = tcx.hir().as_local_hir_id(def_id).unwrap();
// Figure out what primary body this item has. // Figure out what primary body this item has.
@ -171,11 +171,11 @@ pub fn mir_build<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) -> Body<'tcx> {
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// BuildMir -- walks a crate, looking for fn items and methods to build MIR from // BuildMir -- walks a crate, looking for fn items and methods to build MIR from
fn liberated_closure_env_ty<'tcx>( fn liberated_closure_env_ty(
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'_>,
closure_expr_id: hir::HirId, closure_expr_id: hir::HirId,
body_id: hir::BodyId, body_id: hir::BodyId,
) -> Ty<'tcx> { ) -> Ty<'_> {
let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_id); let closure_ty = tcx.body_tables(body_id).node_type(closure_expr_id);
let (closure_def_id, closure_substs) = match closure_ty.sty { let (closure_def_id, closure_substs) = match closure_ty.sty {
@ -485,7 +485,7 @@ macro_rules! unpack {
}; };
} }
fn should_abort_on_panic<'tcx>(tcx: TyCtxt<'tcx>, fn_def_id: DefId, abi: Abi) -> bool { fn should_abort_on_panic(tcx: TyCtxt<'_>, fn_def_id: DefId, abi: Abi) -> bool {
// Not callable from C, so we can safely unwind through these // Not callable from C, so we can safely unwind through these
if abi == Abi::Rust || abi == Abi::RustCall { return false; } if abi == Abi::Rust || abi == Abi::RustCall { return false; }

View File

@ -392,7 +392,7 @@ impl fmt::Debug for Item {
impl Item { impl Item {
/// Finds the `doc` attribute as a NameValue and returns the corresponding /// Finds the `doc` attribute as a NameValue and returns the corresponding
/// value found. /// value found.
pub fn doc_value<'a>(&'a self) -> Option<&'a str> { pub fn doc_value(&self) -> Option<&str> {
self.attrs.doc_value() self.attrs.doc_value()
} }
/// Finds all `doc` attributes as NameValues and returns their corresponding values, joined /// Finds all `doc` attributes as NameValues and returns their corresponding values, joined
@ -699,11 +699,11 @@ impl<'a> Iterator for ListAttributesIter<'a> {
pub trait AttributesExt { pub trait AttributesExt {
/// Finds an attribute as List and returns the list of attributes nested inside. /// Finds an attribute as List and returns the list of attributes nested inside.
fn lists<'a>(&'a self, name: Symbol) -> ListAttributesIter<'a>; fn lists(&self, name: Symbol) -> ListAttributesIter<'_>;
} }
impl AttributesExt for [ast::Attribute] { impl AttributesExt for [ast::Attribute] {
fn lists<'a>(&'a self, name: Symbol) -> ListAttributesIter<'a> { fn lists(&self, name: Symbol) -> ListAttributesIter<'_> {
ListAttributesIter { ListAttributesIter {
attrs: self.iter(), attrs: self.iter(),
current_list: Vec::new().into_iter(), current_list: Vec::new().into_iter(),
@ -952,7 +952,7 @@ impl Attributes {
/// Finds the `doc` attribute as a NameValue and returns the corresponding /// Finds the `doc` attribute as a NameValue and returns the corresponding
/// value found. /// value found.
pub fn doc_value<'a>(&'a self) -> Option<&'a str> { pub fn doc_value(&self) -> Option<&str> {
self.doc_strings.first().map(|s| s.as_str()) self.doc_strings.first().map(|s| s.as_str())
} }
@ -1037,7 +1037,7 @@ impl Hash for Attributes {
} }
impl AttributesExt for Attributes { impl AttributesExt for Attributes {
fn lists<'a>(&'a self, name: Symbol) -> ListAttributesIter<'a> { fn lists(&self, name: Symbol) -> ListAttributesIter<'_> {
self.other_attrs.lists(name) self.other_attrs.lists(name)
} }
} }

View File

@ -331,8 +331,8 @@ pub type CombineSubstructureFunc<'a> =
pub type EnumNonMatchCollapsedFunc<'a> = pub type EnumNonMatchCollapsedFunc<'a> =
Box<dyn FnMut(&mut ExtCtxt<'_>, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>; Box<dyn FnMut(&mut ExtCtxt<'_>, Span, (&[Ident], &[Ident]), &[P<Expr>]) -> P<Expr> + 'a>;
pub fn combine_substructure<'a>(f: CombineSubstructureFunc<'a>) pub fn combine_substructure(f: CombineSubstructureFunc<'_>)
-> RefCell<CombineSubstructureFunc<'a>> { -> RefCell<CombineSubstructureFunc<'_>> {
RefCell::new(f) RefCell::new(f)
} }

View File

@ -39,10 +39,10 @@ pub enum PathKind {
} }
impl<'a> Path<'a> { impl<'a> Path<'a> {
pub fn new<'r>(path: Vec<&'r str>) -> Path<'r> { pub fn new(path: Vec<&str>) -> Path<'_> {
Path::new_(path, None, Vec::new(), PathKind::Std) Path::new_(path, None, Vec::new(), PathKind::Std)
} }
pub fn new_local<'r>(path: &'r str) -> Path<'r> { pub fn new_local(path: &str) -> Path<'_> {
Path::new_(vec![path], None, Vec::new(), PathKind::Local) Path::new_(vec![path], None, Vec::new(), PathKind::Local)
} }
pub fn new_<'r>(path: Vec<&'r str>, pub fn new_<'r>(path: Vec<&'r str>,
@ -117,7 +117,7 @@ pub enum Const {
pub fn borrowed_ptrty<'r>() -> PtrTy<'r> { pub fn borrowed_ptrty<'r>() -> PtrTy<'r> {
Borrowed(None, ast::Mutability::Immutable) Borrowed(None, ast::Mutability::Immutable)
} }
pub fn borrowed<'r>(ty: Box<Ty<'r>>) -> Ty<'r> { pub fn borrowed(ty: Box<Ty<'_>>) -> Ty<'_> {
Ptr(ty, borrowed_ptrty()) Ptr(ty, borrowed_ptrty())
} }