Fix clippy_lints
and clippy_utils
This commit is contained in:
parent
877585089e
commit
66f1f544af
@ -205,7 +205,7 @@ struct Hir2Qmm<'a, 'tcx, 'v> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
|
||||
impl<'v> Hir2Qmm<'_, '_, 'v> {
|
||||
fn extract(&mut self, op: BinOpKind, a: &[&'v Expr<'_>], mut v: Vec<Bool>) -> Result<Vec<Bool>, String> {
|
||||
for a in a {
|
||||
if let ExprKind::Binary(binop, lhs, rhs) = &a.kind {
|
||||
@ -292,7 +292,7 @@ struct SuggestContext<'a, 'tcx, 'v> {
|
||||
output: String,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
|
||||
impl SuggestContext<'_, '_, '_> {
|
||||
fn recurse(&mut self, suggestion: &Bool) -> Option<()> {
|
||||
use quine_mc_cluskey::Bool::{And, False, Not, Or, Term, True};
|
||||
match suggestion {
|
||||
@ -475,7 +475,7 @@ fn recurse(b: &Bool, stats: &mut Stats) {
|
||||
stats
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> {
|
||||
impl<'tcx> NonminimalBoolVisitor<'_, 'tcx> {
|
||||
fn bool_expr(&self, e: &'tcx Expr<'_>) {
|
||||
let mut h2q = Hir2Qmm {
|
||||
terminals: Vec::new(),
|
||||
@ -582,7 +582,7 @@ fn bool_expr(&self, e: &'tcx Expr<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
|
||||
if !e.span.from_expansion() {
|
||||
match &e.kind {
|
||||
|
@ -91,7 +91,7 @@ fn is_local_vec_expn(cx: &LateContext<'_>, expr: &Expr<'_>, ref_expr: &Expr<'_>)
|
||||
#[derive(Default)]
|
||||
struct InferVisitor(bool);
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for InferVisitor {
|
||||
impl Visitor<'_> for InferVisitor {
|
||||
fn visit_ty(&mut self, t: &Ty<'_>) {
|
||||
self.0 |= matches!(t.kind, TyKind::Infer | TyKind::OpaqueDef(..) | TyKind::TraitObject(..));
|
||||
if !self.0 {
|
||||
|
@ -48,7 +48,7 @@ pub fn new(conf: &'static Conf) -> Self {
|
||||
|
||||
impl_lint_pass!(CheckedConversions => [CHECKED_CONVERSIONS]);
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for CheckedConversions {
|
||||
impl LateLintPass<'_> for CheckedConversions {
|
||||
fn check_expr(&mut self, cx: &LateContext<'_>, item: &Expr<'_>) {
|
||||
if let ExprKind::Binary(op, lhs, rhs) = item.kind
|
||||
&& let (lt1, gt1, op2) = match op.node {
|
||||
|
@ -119,7 +119,7 @@ fn check_lit(&self, lit: &Lit, lit_ty: Ty<'tcx>, emit_hir_id: HirId) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for NumericFallbackVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for NumericFallbackVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
match &expr.kind {
|
||||
ExprKind::Block(
|
||||
|
@ -970,7 +970,7 @@ pub fn find_span(
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for FindPanicUnwrap<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
declare_lint_pass!(EmptyEnum => [EMPTY_ENUM]);
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for EmptyEnum {
|
||||
impl LateLintPass<'_> for EmptyEnum {
|
||||
fn check_item(&mut self, cx: &LateContext<'_>, item: &Item<'_>) {
|
||||
if let ItemKind::Enum(..) = item.kind
|
||||
// Only suggest the `never_type` if the feature is enabled
|
||||
|
@ -141,7 +141,7 @@ fn is_argument(tcx: TyCtxt<'_>, id: HirId) -> bool {
|
||||
matches!(tcx.parent_hir_node(id), Node::Param(_))
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
|
||||
impl<'tcx> Delegate<'tcx> for EscapeDelegate<'_, 'tcx> {
|
||||
fn consume(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
|
||||
if cmt.place.projections.is_empty() {
|
||||
if let PlaceBase::Local(lid) = cmt.place.base {
|
||||
@ -188,7 +188,7 @@ fn mutate(&mut self, cmt: &PlaceWithHirId<'tcx>, _: HirId) {
|
||||
fn fake_read(&mut self, _: &PlaceWithHirId<'tcx>, _: FakeReadCause, _: HirId) {}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> EscapeDelegate<'a, 'tcx> {
|
||||
impl<'tcx> EscapeDelegate<'_, 'tcx> {
|
||||
fn is_large_box(&self, ty: Ty<'tcx>) -> bool {
|
||||
// Large types need to be boxed to avoid stack overflows.
|
||||
if let Some(boxed_ty) = ty.boxed_ty() {
|
||||
|
@ -135,7 +135,7 @@ fn check_indent(&mut self, span: Span, id: NodeId) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'conf, 'cx> Visitor<'_> for NestingVisitor<'conf, 'cx> {
|
||||
impl Visitor<'_> for NestingVisitor<'_, '_> {
|
||||
fn visit_block(&mut self, block: &Block) {
|
||||
if block.span.from_expansion() {
|
||||
return;
|
||||
|
@ -193,7 +193,7 @@ fn bound_to_trait_def_id(bound: &GenericBound<'_>) -> Option<LocalDefId> {
|
||||
bound.trait_ref()?.trait_def_id()?.as_local()
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Visitor<'tcx> for TypeWalker<'cx, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for TypeWalker<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_ty(&mut self, t: &'tcx Ty<'tcx>) {
|
||||
|
@ -73,7 +73,7 @@ struct FindPanicUnwrap<'a, 'tcx> {
|
||||
result: Vec<Span>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for FindPanicUnwrap<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
if let Some(macro_call) = root_macro_call_first_node(self.lcx, expr) {
|
||||
if is_panic(self.lcx, macro_call.def_id) {
|
||||
|
@ -219,7 +219,7 @@ struct FormatArgsExpr<'a, 'tcx> {
|
||||
ignore_mixed: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> FormatArgsExpr<'a, 'tcx> {
|
||||
impl FormatArgsExpr<'_, '_> {
|
||||
fn check_templates(&self) {
|
||||
for piece in &self.format_args.template {
|
||||
if let FormatArgsPiece::Placeholder(placeholder) = piece
|
||||
|
@ -148,7 +148,7 @@ struct FormatImplExpr<'a, 'tcx> {
|
||||
format_trait_impl: FormatTraitNames,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> FormatImplExpr<'a, 'tcx> {
|
||||
impl FormatImplExpr<'_, '_> {
|
||||
fn check_to_string_in_display(&self) {
|
||||
if self.format_trait_impl.name == sym::Display
|
||||
&& let ExprKind::MethodCall(path, self_arg, ..) = self.expr.kind
|
||||
|
@ -126,7 +126,7 @@ struct SelfFinder<'a, 'tcx> {
|
||||
invalid: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SelfFinder<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for SelfFinder<'_, 'tcx> {
|
||||
type NestedFilter = OnlyBodies;
|
||||
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
|
@ -281,7 +281,7 @@ fn new(cx: &'a LateContext<'tcx>) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'_, 'tcx> {
|
||||
fn visit_ty(&mut self, t: &'tcx hir::Ty<'_>) {
|
||||
if let Some(target) = ImplicitHasherType::new(self.cx, t) {
|
||||
self.found.push(target);
|
||||
@ -318,7 +318,7 @@ fn new(cx: &'a LateContext<'tcx>, target: &'b ImplicitHasherType<'tcx>) -> Self
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'_, '_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_body(&mut self, body: &Body<'tcx>) {
|
||||
|
@ -226,7 +226,7 @@ struct SliceIndexLintingVisitor<'a, 'tcx> {
|
||||
max_suggested_slice: u64,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for SliceIndexLintingVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
|
@ -397,7 +397,7 @@ fn abort(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for RefVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for RefVisitor<'_, 'tcx> {
|
||||
// for lifetimes as parameters of generics
|
||||
fn visit_lifetime(&mut self, lifetime: &'tcx Lifetime) {
|
||||
self.lts.push(*lifetime);
|
||||
|
@ -209,7 +209,7 @@ fn print_offset(offset: MinifyingSugg<'static>) -> MinifyingSugg<'static> {
|
||||
#[derive(Clone)]
|
||||
struct MinifyingSugg<'a>(Sugg<'a>);
|
||||
|
||||
impl<'a> Display for MinifyingSugg<'a> {
|
||||
impl Display for MinifyingSugg<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
self.0.fmt(f)
|
||||
}
|
||||
|
@ -241,7 +241,7 @@ struct VarVisitor<'a, 'tcx> {
|
||||
prefer_mutable: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> VarVisitor<'a, 'tcx> {
|
||||
impl<'tcx> VarVisitor<'_, 'tcx> {
|
||||
fn check(&mut self, idx: &'tcx Expr<'_>, seqexpr: &'tcx Expr<'_>, expr: &'tcx Expr<'_>) -> bool {
|
||||
if let ExprKind::Path(ref seqpath) = seqexpr.kind
|
||||
// the indexed container is referenced by a name
|
||||
@ -292,7 +292,7 @@ fn check(&mut self, idx: &'tcx Expr<'_>, seqexpr: &'tcx Expr<'_>, expr: &'tcx Ex
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for VarVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for VarVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
if let ExprKind::MethodCall(meth, args_0, [args_1, ..], _) = &expr.kind
|
||||
// a range index op
|
||||
|
@ -123,7 +123,7 @@ fn should_lint(&self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SameItemPushVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for SameItemPushVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
match &expr.kind {
|
||||
// Non-determinism may occur ... don't give a lint
|
||||
|
@ -44,7 +44,7 @@ pub(super) fn into_results(self) -> impl Iterator<Item = HirId> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for IncrementVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for IncrementVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
// If node is a variable
|
||||
if let Some(def_id) = path_to_local(expr) {
|
||||
@ -138,7 +138,7 @@ pub(super) fn get_result(&self) -> Option<(Symbol, Option<Ty<'tcx>>, &'tcx Expr<
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for InitializeVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for InitializeVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_local(&mut self, l: &'tcx LetStmt<'_>) {
|
||||
|
@ -84,7 +84,7 @@ struct VarCollectorVisitor<'a, 'tcx> {
|
||||
skip: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> VarCollectorVisitor<'a, 'tcx> {
|
||||
impl<'tcx> VarCollectorVisitor<'_, 'tcx> {
|
||||
fn insert_def_id(&mut self, ex: &'tcx Expr<'_>) {
|
||||
if let ExprKind::Path(ref qpath) = ex.kind
|
||||
&& let QPath::Resolved(None, _) = *qpath
|
||||
@ -103,7 +103,7 @@ fn insert_def_id(&mut self, ex: &'tcx Expr<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for VarCollectorVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for VarCollectorVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
match ex.kind {
|
||||
ExprKind::Path(_) => self.insert_def_id(ex),
|
||||
|
@ -283,7 +283,7 @@ struct NestedLoopVisitor<'a, 'b, 'tcx> {
|
||||
found_local: bool,
|
||||
used_after: bool,
|
||||
}
|
||||
impl<'a, 'b, 'tcx> Visitor<'tcx> for NestedLoopVisitor<'a, 'b, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for NestedLoopVisitor<'_, '_, 'tcx> {
|
||||
type NestedFilter = OnlyBodies;
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.cx.tcx.hir()
|
||||
|
@ -149,7 +149,7 @@ fn is_public_macro(cx: &LateContext<'_>, def_id: LocalDefId) -> bool {
|
||||
&& !cx.tcx.is_doc_hidden(def_id)
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for BodyVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for BodyVisitor<'_, 'tcx> {
|
||||
fn visit_stmt(&mut self, s: &'tcx Stmt<'tcx>) {
|
||||
let from_expn = s.span.from_expansion();
|
||||
if from_expn {
|
||||
|
@ -81,7 +81,7 @@ fn push_unique_macro_pat_ty(&mut self, cx: &LateContext<'_>, span: Span) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for MacroUseImports {
|
||||
impl LateLintPass<'_> for MacroUseImports {
|
||||
fn check_item(&mut self, cx: &LateContext<'_>, item: &hir::Item<'_>) {
|
||||
if cx.sess().opts.edition >= Edition::Edition2018
|
||||
&& let hir::ItemKind::Use(path, _kind) = &item.kind
|
||||
|
@ -741,7 +741,7 @@ enum MaybeBorrowedStmtKind<'a> {
|
||||
Owned(StmtKind<'a>),
|
||||
}
|
||||
|
||||
impl<'a> Clone for MaybeBorrowedStmtKind<'a> {
|
||||
impl Clone for MaybeBorrowedStmtKind<'_> {
|
||||
fn clone(&self) -> Self {
|
||||
match self {
|
||||
Self::Borrowed(t) => Self::Borrowed(t),
|
||||
|
@ -203,7 +203,7 @@ struct StrippingFinder<'a, 'tcx> {
|
||||
results: Vec<Span>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for StrippingFinder<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for StrippingFinder<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
if is_ref_str(self.cx, ex)
|
||||
&& let unref = peel_ref(ex)
|
||||
|
@ -251,7 +251,7 @@ fn lint_map_unit_fn(
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> LateLintPass<'tcx> for MapUnit {
|
||||
impl LateLintPass<'_> for MapUnit {
|
||||
fn check_stmt(&mut self, cx: &LateContext<'_>, stmt: &hir::Stmt<'_>) {
|
||||
if let hir::StmtKind::Semi(expr) = stmt.kind
|
||||
&& !stmt.span.from_expansion()
|
||||
|
@ -40,7 +40,7 @@ struct MatchExprVisitor<'a, 'tcx> {
|
||||
case_method: Option<CaseMethod>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MatchExprVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for MatchExprVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
match ex.kind {
|
||||
ExprKind::MethodCall(segment, receiver, [], _) if self.case_altered(segment.ident.as_str(), receiver) => {},
|
||||
@ -49,7 +49,7 @@ fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> MatchExprVisitor<'a, 'tcx> {
|
||||
impl MatchExprVisitor<'_, '_> {
|
||||
fn case_altered(&mut self, segment_ident: &str, receiver: &Expr<'_>) -> bool {
|
||||
if let Some(case_method) = get_case_method(segment_ident) {
|
||||
let ty = self.cx.typeck_results().expr_ty(receiver).peel_refs();
|
||||
|
@ -96,13 +96,13 @@ enum BoundKind {
|
||||
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
|
||||
struct RangeBound<'a, T>(T, BoundKind, &'a SpannedRange<T>);
|
||||
|
||||
impl<'a, T: Copy + Ord> PartialOrd for RangeBound<'a, T> {
|
||||
impl<T: Copy + Ord> PartialOrd for RangeBound<'_, T> {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, T: Copy + Ord> Ord for RangeBound<'a, T> {
|
||||
impl<T: Copy + Ord> Ord for RangeBound<'_, T> {
|
||||
fn cmp(&self, RangeBound(other_value, other_kind, _): &Self) -> Ordering {
|
||||
let RangeBound(self_value, self_kind, _) = *self;
|
||||
(self_value, self_kind).cmp(&(*other_value, *other_kind))
|
||||
|
@ -424,7 +424,7 @@ fn visit_region(&mut self, region: Region<'tcx>) -> Self::Result {
|
||||
ty.visit_with(&mut V).is_break()
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SigDropHelper<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for SigDropHelper<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'_>) {
|
||||
// We've emitted a lint on some neighborhood expression. That lint will suggest to move out the
|
||||
// _parent_ expression (not the expression itself). Since we decide to move out the parent
|
||||
@ -495,7 +495,7 @@ fn has_significant_drop_in_arms<'tcx>(cx: &LateContext<'tcx>, arms: &[&'tcx Expr
|
||||
helper.found_sig_drop_spans
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ArmSigDropHelper<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ArmSigDropHelper<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
|
||||
if self.sig_drop_checker.is_sig_drop_expr(ex) {
|
||||
self.found_sig_drop_spans.insert(ex.span);
|
||||
|
@ -441,7 +441,7 @@ struct UsedCountVisitor<'a, 'tcx> {
|
||||
count: usize,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for UsedCountVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for UsedCountVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
|
@ -130,7 +130,7 @@ struct UnwrapVisitor<'a, 'tcx> {
|
||||
identifiers: FxHashSet<HirId>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for UnwrapVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn visit_path(&mut self, path: &Path<'tcx>, _: HirId) {
|
||||
@ -154,7 +154,7 @@ struct ReferenceVisitor<'a, 'tcx> {
|
||||
unwrap_or_span: Span,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ReferenceVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ReferenceVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
type Result = ControlFlow<()>;
|
||||
fn visit_expr(&mut self, expr: &'tcx rustc_hir::Expr<'_>) -> ControlFlow<()> {
|
||||
|
@ -86,7 +86,7 @@ struct CloneOrCopyVisitor<'cx, 'tcx> {
|
||||
references_to_binding: Vec<(Span, String)>,
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Visitor<'tcx> for CloneOrCopyVisitor<'cx, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for CloneOrCopyVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
@ -123,7 +123,7 @@ fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> CloneOrCopyVisitor<'cx, 'tcx> {
|
||||
impl<'tcx> CloneOrCopyVisitor<'_, 'tcx> {
|
||||
fn is_binding(&self, expr: &Expr<'tcx>) -> bool {
|
||||
self.binding_hir_ids
|
||||
.iter()
|
||||
|
@ -116,7 +116,7 @@ struct DivergenceVisitor<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> DivergenceVisitor<'a, 'tcx> {
|
||||
impl<'tcx> DivergenceVisitor<'_, 'tcx> {
|
||||
fn maybe_walk_expr(&mut self, e: &'tcx Expr<'_>) {
|
||||
match e.kind {
|
||||
ExprKind::Closure(..) | ExprKind::If(..) | ExprKind::Loop(..) => {},
|
||||
@ -148,7 +148,7 @@ fn stmt_might_diverge(stmt: &Stmt<'_>) -> bool {
|
||||
!matches!(stmt.kind, StmtKind::Item(..))
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for DivergenceVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for DivergenceVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
|
||||
match e.kind {
|
||||
// fix #10776
|
||||
@ -321,7 +321,7 @@ struct ReadVisitor<'a, 'tcx> {
|
||||
last_expr: &'tcx Expr<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ReadVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
if expr.hir_id == self.last_expr.hir_id {
|
||||
return;
|
||||
|
@ -55,7 +55,7 @@ pub struct MutVisitor<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> intravisit::Visitor<'tcx> for MutVisitor<'a, 'tcx> {
|
||||
impl<'tcx> intravisit::Visitor<'tcx> for MutVisitor<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'_>) {
|
||||
if in_external_macro(self.cx.sess(), expr.span) {
|
||||
return;
|
||||
|
@ -87,7 +87,7 @@ fn expr_span(&self) -> Option<Span> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for MutArgVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for MutArgVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
|
@ -133,7 +133,7 @@ struct RetCollector {
|
||||
loop_depth: u16,
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for RetCollector {
|
||||
impl Visitor<'_> for RetCollector {
|
||||
fn visit_expr(&mut self, expr: &Expr<'_>) {
|
||||
match expr.kind {
|
||||
ExprKind::Ret(..) => {
|
||||
|
@ -311,7 +311,7 @@ struct MutablyUsedVariablesCtxt<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
}
|
||||
|
||||
impl<'tcx> MutablyUsedVariablesCtxt<'tcx> {
|
||||
impl MutablyUsedVariablesCtxt<'_> {
|
||||
fn add_mutably_used_var(&mut self, used_id: HirId) {
|
||||
self.mutably_used_vars.insert(used_id);
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ struct SimilarNamesLocalVisitor<'a, 'tcx> {
|
||||
single_char_names: Vec<Vec<Ident>>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> SimilarNamesLocalVisitor<'a, 'tcx> {
|
||||
impl SimilarNamesLocalVisitor<'_, '_> {
|
||||
fn check_single_char_names(&self) {
|
||||
if self.single_char_names.last().map(Vec::len) == Some(0) {
|
||||
return;
|
||||
@ -152,7 +152,7 @@ fn chars_are_similar(a: char, b: char) -> bool {
|
||||
|
||||
struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
|
||||
|
||||
impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
|
||||
impl<'tcx> Visitor<'tcx> for SimilarNamesNameVisitor<'_, 'tcx, '_> {
|
||||
fn visit_pat(&mut self, pat: &'tcx Pat) {
|
||||
match pat.kind {
|
||||
PatKind::Ident(_, ident, _) => {
|
||||
@ -189,7 +189,7 @@ fn allowed_to_be_similar(interned_name: &str, list: &[&str]) -> bool {
|
||||
.any(|&name| interned_name.starts_with(name) || interned_name.ends_with(name))
|
||||
}
|
||||
|
||||
impl<'a, 'tcx, 'b> SimilarNamesNameVisitor<'a, 'tcx, 'b> {
|
||||
impl SimilarNamesNameVisitor<'_, '_, '_> {
|
||||
fn check_short_ident(&mut self, ident: Ident) {
|
||||
// Ignore shadowing
|
||||
if self
|
||||
@ -329,7 +329,7 @@ fn equal_length_strs_not_similar(interned_name: &str, existing_name: &str) -> bo
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b> SimilarNamesLocalVisitor<'a, 'b> {
|
||||
impl SimilarNamesLocalVisitor<'_, '_> {
|
||||
/// ensure scoping rules work
|
||||
fn apply<F: for<'c> Fn(&'c mut Self)>(&mut self, f: F) {
|
||||
let n = self.names.len();
|
||||
@ -340,7 +340,7 @@ fn apply<F: for<'c> Fn(&'c mut Self)>(&mut self, f: F) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for SimilarNamesLocalVisitor<'_, 'tcx> {
|
||||
fn visit_local(&mut self, local: &'tcx Local) {
|
||||
if let Some((init, els)) = &local.kind.init_else_opt() {
|
||||
self.apply(|this| walk_expr(this, init));
|
||||
|
@ -159,7 +159,7 @@ struct NonSendField<'tcx> {
|
||||
generic_params: Vec<Ty<'tcx>>,
|
||||
}
|
||||
|
||||
impl<'tcx> NonSendField<'tcx> {
|
||||
impl NonSendField<'_> {
|
||||
fn generic_params_string(&self) -> String {
|
||||
self.generic_params
|
||||
.iter()
|
||||
|
@ -110,7 +110,7 @@ pub struct PassByRefOrValue {
|
||||
avoid_breaking_exported_api: bool,
|
||||
}
|
||||
|
||||
impl<'tcx> PassByRefOrValue {
|
||||
impl PassByRefOrValue {
|
||||
pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self {
|
||||
let ref_min_size = conf.trivial_copy_size_limit.unwrap_or_else(|| {
|
||||
let bit_width = u64::from(tcx.sess.target.pointer_width);
|
||||
@ -130,7 +130,7 @@ pub fn new(tcx: TyCtxt<'_>, conf: &'static Conf) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
fn check_poly_fn(&mut self, cx: &LateContext<'tcx>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
|
||||
fn check_poly_fn(&mut self, cx: &LateContext<'_>, def_id: LocalDefId, decl: &FnDecl<'_>, span: Option<Span>) {
|
||||
if self.avoid_breaking_exported_api && cx.effective_visibilities.is_exported(def_id) {
|
||||
return;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ struct PathbufPushSearcher<'tcx> {
|
||||
err_span: Span,
|
||||
}
|
||||
|
||||
impl<'tcx> PathbufPushSearcher<'tcx> {
|
||||
impl PathbufPushSearcher<'_> {
|
||||
/// Try to generate a suggestion with `PathBuf::from`.
|
||||
/// Returns `None` if the suggestion would be invalid.
|
||||
fn gen_pathbuf_from(&self, cx: &LateContext<'_>) -> Option<String> {
|
||||
|
@ -228,7 +228,7 @@ struct ClosureUsageCount<'a, 'tcx> {
|
||||
path: &'tcx hir::Path<'tcx>,
|
||||
count: usize,
|
||||
}
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ClosureUsageCount<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ClosureUsageCount<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx hir::Expr<'tcx>) {
|
||||
|
@ -140,7 +140,7 @@ enum RetReplacement<'tcx> {
|
||||
Expr(Cow<'tcx, str>, Applicability),
|
||||
}
|
||||
|
||||
impl<'tcx> RetReplacement<'tcx> {
|
||||
impl RetReplacement<'_> {
|
||||
fn sugg_help(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Empty | Self::Expr(..) => "remove `return`",
|
||||
@ -158,7 +158,7 @@ fn applicability(&self) -> Applicability {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Display for RetReplacement<'tcx> {
|
||||
impl Display for RetReplacement<'_> {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
match self {
|
||||
Self::Empty => write!(f, ""),
|
||||
|
@ -249,7 +249,7 @@ fn manage_has_expensive_expr_after_last_attr(&mut self) {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'ap, 'lc, 'others, 'stmt, 'tcx> Visitor<'tcx> for StmtsChecker<'ap, 'lc, 'others, 'stmt, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for StmtsChecker<'_, '_, '_, '_, 'tcx> {
|
||||
fn visit_block(&mut self, block: &'tcx hir::Block<'tcx>) {
|
||||
self.ap.curr_block_hir_id = block.hir_id;
|
||||
self.ap.curr_block_span = block.span;
|
||||
|
@ -102,7 +102,7 @@ struct ImportUsageVisitor {
|
||||
imports_referenced_with_self: Vec<Symbol>,
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for ImportUsageVisitor {
|
||||
impl Visitor<'_> for ImportUsageVisitor {
|
||||
fn visit_expr(&mut self, expr: &Expr) {
|
||||
if let ExprKind::Path(_, path) = &expr.kind
|
||||
&& path.segments.len() > 1
|
||||
|
@ -229,7 +229,7 @@ struct VectorInitializationVisitor<'a, 'tcx> {
|
||||
initialization_found: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> VectorInitializationVisitor<'a, 'tcx> {
|
||||
impl<'tcx> VectorInitializationVisitor<'_, 'tcx> {
|
||||
/// Checks if the given expression is extending a vector with `repeat(0).take(..)`
|
||||
fn search_slow_extend_filling(&mut self, expr: &'tcx Expr<'_>) {
|
||||
if self.initialization_found
|
||||
@ -299,7 +299,7 @@ fn is_repeat_zero(&self, expr: &Expr<'_>) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for VectorInitializationVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for VectorInitializationVisitor<'_, 'tcx> {
|
||||
fn visit_stmt(&mut self, stmt: &'tcx Stmt<'_>) {
|
||||
if self.initialization_found {
|
||||
match stmt.kind {
|
||||
|
@ -332,7 +332,7 @@ struct IndexBinding<'a, 'tcx> {
|
||||
applicability: &'a mut Applicability,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> IndexBinding<'a, 'tcx> {
|
||||
impl<'tcx> IndexBinding<'_, 'tcx> {
|
||||
fn snippet_index_bindings(&mut self, exprs: &[&'tcx Expr<'tcx>]) -> String {
|
||||
let mut bindings = FxHashSet::default();
|
||||
for expr in exprs {
|
||||
|
@ -67,7 +67,7 @@ struct AsyncFnVisitor<'a, 'tcx> {
|
||||
async_depth: usize,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for AsyncFnVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for AsyncFnVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, ex: &'tcx Expr<'tcx>) {
|
||||
|
@ -235,7 +235,7 @@ fn consume(&mut self, _: &PlaceWithHirId<'tcx>, _: HirId) {}
|
||||
fn fake_read(&mut self, _: &PlaceWithHirId<'tcx>, _: FakeReadCause, _: HirId) {}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> UnwrappableVariablesVisitor<'a, 'tcx> {
|
||||
impl<'tcx> UnwrappableVariablesVisitor<'_, 'tcx> {
|
||||
fn visit_branch(
|
||||
&mut self,
|
||||
if_expr: &'tcx Expr<'_>,
|
||||
@ -288,7 +288,7 @@ fn consume_option_as_ref<'tcx>(expr: &'tcx Expr<'tcx>) -> (&'tcx Expr<'tcx>, Opt
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for UnwrappableVariablesVisitor<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'_>) {
|
||||
|
@ -280,7 +280,7 @@ struct SkipTyCollector {
|
||||
types_to_skip: Vec<HirId>,
|
||||
}
|
||||
|
||||
impl<'tcx> Visitor<'tcx> for SkipTyCollector {
|
||||
impl Visitor<'_> for SkipTyCollector {
|
||||
fn visit_infer(&mut self, inf: &hir::InferArg) {
|
||||
self.types_to_skip.push(inf.hir_id);
|
||||
|
||||
|
@ -270,7 +270,7 @@ struct LintCollector<'a, 'tcx> {
|
||||
cx: &'a LateContext<'tcx>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for LintCollector<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for LintCollector<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::All;
|
||||
|
||||
fn visit_path(&mut self, path: &Path<'_>, _: HirId) {
|
||||
|
@ -118,7 +118,7 @@ enum WaitFinder<'a, 'tcx> {
|
||||
Found(&'a LateContext<'tcx>, HirId),
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for WaitFinder<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for WaitFinder<'_, 'tcx> {
|
||||
type Result = ControlFlow<BreakReason>;
|
||||
|
||||
fn visit_local(&mut self, l: &'tcx LetStmt<'tcx>) -> Self::Result {
|
||||
@ -300,7 +300,7 @@ struct ExitPointFinder<'a, 'tcx> {
|
||||
|
||||
struct ExitCallFound;
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ExitPointFinder<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ExitPointFinder<'_, 'tcx> {
|
||||
type Result = ControlFlow<ExitCallFound>;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) -> Self::Result {
|
||||
|
@ -118,7 +118,7 @@ fn bits(self) -> Self::Output {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> PartialEq for Constant<'tcx> {
|
||||
impl PartialEq for Constant<'_> {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
match (self, other) {
|
||||
(Self::Str(ls), Self::Str(rs)) => ls == rs,
|
||||
@ -147,7 +147,7 @@ fn eq(&self, other: &Self) -> bool {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Hash for Constant<'tcx> {
|
||||
impl Hash for Constant<'_> {
|
||||
fn hash<H>(&self, state: &mut H)
|
||||
where
|
||||
H: Hasher,
|
||||
@ -203,7 +203,7 @@ fn hash<H>(&self, state: &mut H)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'tcx> Constant<'tcx> {
|
||||
impl Constant<'_> {
|
||||
pub fn partial_cmp(tcx: TyCtxt<'_>, cmp_type: Ty<'_>, left: &Self, right: &Self) -> Option<Ordering> {
|
||||
match (left, right) {
|
||||
(Self::Str(ls), Self::Str(rs)) => Some(ls.cmp(rs)),
|
||||
|
@ -118,7 +118,7 @@ struct V<'cx, 'tcx> {
|
||||
eagerness: EagernessSuggestion,
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Visitor<'tcx> for V<'cx, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for V<'_, 'tcx> {
|
||||
fn visit_expr(&mut self, e: &'tcx Expr<'_>) {
|
||||
use EagernessSuggestion::{ForceNoChange, Lazy, NoChange};
|
||||
if self.eagerness == ForceNoChange {
|
||||
|
@ -1345,7 +1345,7 @@ pub struct ContainsName<'a, 'tcx> {
|
||||
pub result: bool,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for ContainsName<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for ContainsName<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_name(&mut self, name: Symbol) {
|
||||
@ -3115,7 +3115,7 @@ struct V<'cx, 'tcx> {
|
||||
is_never: bool,
|
||||
}
|
||||
|
||||
impl<'tcx> V<'_, 'tcx> {
|
||||
impl V<'_, '_> {
|
||||
fn push_break_target(&mut self, id: HirId) {
|
||||
self.break_targets.push(BreakTarget { id, unused: true });
|
||||
self.break_targets_for_result_ty += u32::from(self.in_final_expr);
|
||||
|
@ -58,7 +58,7 @@ struct V<'a> {
|
||||
results: Vec<LocalUsage>,
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> Visitor<'tcx> for V<'a> {
|
||||
impl<'tcx> Visitor<'tcx> for V<'_> {
|
||||
fn visit_place(&mut self, place: &Place<'tcx>, ctx: PlaceContext, loc: Location) {
|
||||
if loc.block == self.location.block && loc.statement_index <= self.location.statement_index {
|
||||
return;
|
||||
|
@ -65,7 +65,7 @@ fn into_map(
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'a, 'b, 'tcx> {
|
||||
impl<'tcx> mir::visit::Visitor<'tcx> for PossibleBorrowerVisitor<'_, '_, 'tcx> {
|
||||
fn visit_assign(&mut self, place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'_>, _location: mir::Location) {
|
||||
let lhs = place.local;
|
||||
match rvalue {
|
||||
@ -177,8 +177,8 @@ pub struct PossibleBorrowerMap<'b, 'tcx> {
|
||||
pub bitset: (BitSet<mir::Local>, BitSet<mir::Local>),
|
||||
}
|
||||
|
||||
impl<'a, 'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
|
||||
pub fn new(cx: &'a LateContext<'tcx>, mir: &'b mir::Body<'tcx>) -> Self {
|
||||
impl<'b, 'tcx> PossibleBorrowerMap<'b, 'tcx> {
|
||||
pub fn new(cx: &LateContext<'tcx>, mir: &'b mir::Body<'tcx>) -> Self {
|
||||
let possible_origin = {
|
||||
let mut vis = PossibleOriginVisitor::new(mir);
|
||||
vis.visit_body(mir);
|
||||
|
@ -39,7 +39,7 @@ pub fn into_map(self, cx: &LateContext<'tcx>) -> FxHashMap<mir::Local, HybridBit
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a, 'tcx> mir::visit::Visitor<'tcx> for PossibleOriginVisitor<'a, 'tcx> {
|
||||
impl<'tcx> mir::visit::Visitor<'tcx> for PossibleOriginVisitor<'_, 'tcx> {
|
||||
fn visit_assign(&mut self, place: &mir::Place<'tcx>, rvalue: &mir::Rvalue<'_>, _location: mir::Location) {
|
||||
let lhs = place.local;
|
||||
match rvalue {
|
||||
|
@ -108,7 +108,7 @@ fn new(cx: &'cx LateContext<'tcx>) -> Self {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'cx, 'tcx> Visitor<'cx> for CertaintyVisitor<'cx, 'tcx> {
|
||||
impl<'cx> Visitor<'cx> for CertaintyVisitor<'cx, '_> {
|
||||
fn visit_qpath(&mut self, qpath: &'cx QPath<'_>, hir_id: HirId, _: Span) {
|
||||
self.certainty = self.certainty.meet(qpath_certainty(self.cx, qpath, true));
|
||||
if self.certainty != Certainty::Uncertain {
|
||||
|
@ -46,8 +46,8 @@ struct MutVarsDelegate {
|
||||
skip: bool,
|
||||
}
|
||||
|
||||
impl<'tcx> MutVarsDelegate {
|
||||
fn update(&mut self, cat: &PlaceWithHirId<'tcx>) {
|
||||
impl MutVarsDelegate {
|
||||
fn update(&mut self, cat: &PlaceWithHirId<'_>) {
|
||||
match cat.place.base {
|
||||
PlaceBase::Local(id) => {
|
||||
self.used_mutably.insert(id);
|
||||
@ -122,7 +122,7 @@ pub fn are_params_used(cx: &'a LateContext<'tcx>, body: &'tcx hir::Body<'tcx>) -
|
||||
finder.usage_found
|
||||
}
|
||||
}
|
||||
impl<'a, 'tcx> Visitor<'tcx> for BindingUsageFinder<'a, 'tcx> {
|
||||
impl<'tcx> Visitor<'tcx> for BindingUsageFinder<'_, 'tcx> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
|
||||
fn visit_expr(&mut self, expr: &'tcx Expr<'tcx>) {
|
||||
|
@ -552,7 +552,7 @@ struct V<'cx, 'tcx, F, B> {
|
||||
res: ControlFlow<B>,
|
||||
f: F,
|
||||
}
|
||||
impl<'cx, 'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'cx, 'tcx, F, B> {
|
||||
impl<'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'_, 'tcx, F, B> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.cx.tcx.hir()
|
||||
@ -734,7 +734,7 @@ struct V<'cx, 'tcx, F, B> {
|
||||
res: ControlFlow<B>,
|
||||
f: F,
|
||||
}
|
||||
impl<'cx, 'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'cx, 'tcx, F, B> {
|
||||
impl<'tcx, F: FnMut(&'tcx Expr<'tcx>) -> ControlFlow<B>, B> Visitor<'tcx> for V<'_, 'tcx, F, B> {
|
||||
type NestedFilter = nested_filter::OnlyBodies;
|
||||
fn nested_visit_map(&mut self) -> Self::Map {
|
||||
self.cx.tcx.hir()
|
||||
|
Loading…
Reference in New Issue
Block a user