未验证 提交 d50a3a7b 编写于 作者: J Jeremy Stucki 提交者: Jeremy Stucki

Remove needless lifetimes

上级 6ae80cf2
......@@ -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()
......
......@@ -115,7 +115,7 @@ pub fn new() -> 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
}
......
......@@ -247,11 +247,11 @@ pub fn predecessor_nodes<'a>(
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)
}
......
......@@ -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 {
......
......@@ -29,7 +29,7 @@
/// 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 {
......
......@@ -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();
......@@ -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)
......
......@@ -698,31 +698,31 @@ fn visit_trait_item(&mut self, _: &'tcx hir::TraitItem) { }
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);
}
......@@ -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)
}
......@@ -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 {
......@@ -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);
......@@ -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);
......@@ -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()
......@@ -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
......@@ -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
......@@ -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,
) {
......@@ -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
......@@ -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() {
......@@ -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() {
......@@ -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);
......@@ -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;
......@@ -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(),
......
......@@ -68,7 +68,7 @@ fn with_fcx<F>(&mut self, f: F)
/// 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);
......@@ -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);
......@@ -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);
......@@ -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>,
......@@ -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),
......@@ -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);
......@@ -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);
......@@ -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,
......@@ -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();
......@@ -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);
......@@ -1135,11 +1135,11 @@ fn impl_implied_bounds(&self, impl_def_id: DefId, span: Span) -> Vec<Ty<'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");
......
......@@ -17,7 +17,7 @@
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)
......@@ -46,7 +46,7 @@ fn check<F>(&self, trait_def_id: Option<DefId>, mut f: F) -> &Self
}
}
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 {
......@@ -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) {
......@@ -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() {
......
......@@ -17,10 +17,10 @@
use syntax_pos::Span;
/// On-demand query: yields a map containing all types mapped to their inherent impls.
pub fn crate_inherent_impls<'tcx>(
tcx: TyCtxt<'tcx>,
pub fn crate_inherent_impls(
tcx: TyCtxt<'_>,
crate_num: CrateNum,
) -> &'tcx CrateInherentImpls {
) -> &CrateInherentImpls {
assert_eq!(crate_num, LOCAL_CRATE);
let krate = tcx.hir().krate();
......@@ -33,7 +33,7 @@ pub fn crate_inherent_impls<'tcx>(
}
/// On-demand query: yields a vector of the inherent impls for a specific type.
pub fn inherent_impls<'tcx>(tcx: TyCtxt<'tcx>, ty_def_id: DefId) -> &'tcx [DefId] {
pub fn inherent_impls(tcx: TyCtxt<'_>, ty_def_id: DefId) -> &[DefId] {
assert!(ty_def_id.is_local());
// NB. Until we adopt the red-green dep-tracking algorithm (see
......
......@@ -5,7 +5,7 @@
use rustc::traits::{self, IntercrateMode};
use rustc::ty::TyCtxt;
pub fn crate_inherent_impls_overlap_check<'tcx>(tcx: TyCtxt<'tcx>, crate_num: CrateNum) {
pub fn crate_inherent_impls_overlap_check(tcx: TyCtxt<'_>, crate_num: CrateNum) {
assert_eq!(crate_num, LOCAL_CRATE);
let krate = tcx.hir().krate();
krate.visit_all_item_likes(&mut InherentOverlapChecker { tcx });
......
......@@ -18,7 +18,7 @@
mod orphan;
mod unsafety;
fn check_impl<'tcx>(tcx: TyCtxt<'tcx>, hir_id: HirId) {
fn check_impl(tcx: TyCtxt<'_>, hir_id: HirId) {
let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
// If there are no traits, then this implementation must have a
......@@ -124,7 +124,7 @@ pub fn provide(providers: &mut Providers<'_>) {
};
}
fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
fn coherent_trait(tcx: TyCtxt<'_>, def_id: DefId) {
let impls = tcx.hir().trait_impls(def_id);
for &impl_id in impls {
check_impl(tcx, impl_id);
......@@ -135,7 +135,7 @@ fn coherent_trait<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId) {
builtin::check_trait(tcx, def_id);
}
pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx>) {
pub fn check_coherence(tcx: TyCtxt<'_>) {
for &trait_def_id in tcx.hir().krate().trait_impls.keys() {
tcx.ensure().coherent_trait(trait_def_id);
}
......@@ -151,7 +151,7 @@ pub fn check_coherence<'tcx>(tcx: TyCtxt<'tcx>) {
/// Overlap: no two impls for the same trait are implemented for the
/// same type. Likewise, no two inherent impls for a given type
/// constructor provide a method with the same name.
fn check_impl_overlap<'tcx>(tcx: TyCtxt<'tcx>, hir_id: HirId) {
fn check_impl_overlap(tcx: TyCtxt<'_>, hir_id: HirId) {
let impl_def_id = tcx.hir().local_def_id_from_hir_id(hir_id);
let trait_ref = tcx.impl_trait_ref(impl_def_id).unwrap();
let trait_def_id = trait_ref.def_id;
......
......@@ -6,7 +6,7 @@
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir;
pub fn check<'tcx>(tcx: TyCtxt<'tcx>) {
pub fn check(tcx: TyCtxt<'_>) {
let mut orphan = OrphanChecker { tcx };
tcx.hir().krate().visit_all_item_likes(&mut orphan);
}
......
......@@ -5,7 +5,7 @@
use rustc::hir::itemlikevisit::ItemLikeVisitor;
use rustc::hir::{self, Unsafety};
pub fn check<'tcx>(tcx: TyCtxt<'tcx>) {
pub fn check(tcx: TyCtxt<'_>) {
let mut unsafety = UnsafetyChecker { tcx };
tcx.hir().krate().visit_all_item_likes(&mut unsafety);
}
......
......@@ -2541,7 +2541,7 @@ fn full_path(cx: &Context, item: &clean::Item) -> String {
s
}
fn shorter<'a>(s: Option<&'a str>) -> String {
fn shorter(s: Option<&str>) -> String {
match s {
Some(s) => s.lines()
.skip_while(|s| s.chars().all(|c| c.is_whitespace()))
......
......@@ -119,7 +119,7 @@ fn fold_until(&mut self, level: u32) {
/// Push a level `level` heading into the appropriate place in the
/// hierarchy, returning a string containing the section number in
/// `<num>.<num>.<num>` format.
pub fn push<'a>(&'a mut self, level: u32, name: String, id: String) -> &'a str {
pub fn push(&mut self, level: u32, name: String, id: String) -> &str {
assert!(level >= 1);
// collapse all previous sections into their parents until we
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册