Stop using in_band_lifetimes
This commit is contained in:
parent
fccf07bae5
commit
02ec39b2ff
77 changed files with 216 additions and 189 deletions
|
|
@ -14,7 +14,7 @@ use super::EXPECT_FUN_CALL;
|
|||
|
||||
/// Checks for the `EXPECT_FUN_CALL` lint.
|
||||
#[allow(clippy::too_many_lines)]
|
||||
pub(super) fn check(
|
||||
pub(super) fn check<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &hir::Expr<'_>,
|
||||
method_span: Span,
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &hir::Expr<'_>, args: &[hir::Exp
|
|||
}
|
||||
}
|
||||
|
||||
fn extract_turbofish(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ty: Ty<'tcx>) -> String {
|
||||
fn extract_turbofish(cx: &LateContext<'_>, expr: &hir::Expr<'_>, ty: Ty<'_>) -> String {
|
||||
fn strip_angle_brackets(s: &str) -> Option<&str> {
|
||||
s.strip_prefix('<')?.strip_suffix('>')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ struct IterUsage {
|
|||
}
|
||||
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn parse_iter_usage(
|
||||
fn parse_iter_usage<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
ctxt: SyntaxContext,
|
||||
mut iter: impl Iterator<Item = (HirId, Node<'tcx>)>,
|
||||
|
|
@ -281,7 +281,7 @@ pub(super) fn check_needless_splitn(
|
|||
}
|
||||
}
|
||||
|
||||
fn check_iter(
|
||||
fn check_iter<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
ctxt: SyntaxContext,
|
||||
mut iter: impl Iterator<Item = (HirId, Node<'tcx>)>,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use rustc_span::{sym, Symbol};
|
|||
|
||||
use super::UNNECESSARY_TO_OWNED;
|
||||
|
||||
pub fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol, receiver: &'tcx Expr<'tcx>) -> bool {
|
||||
pub fn check(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol, receiver: &Expr<'_>) -> bool {
|
||||
if_chain! {
|
||||
if let Some(parent) = get_parent_expr(cx, expr);
|
||||
if let Some(callee_def_id) = fn_def_id(cx, parent);
|
||||
|
|
@ -30,10 +30,10 @@ pub fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol
|
|||
/// include this code directly is so that it can be called from
|
||||
/// `unnecessary_into_owned::check_into_iter_call_arg`.
|
||||
pub fn check_for_loop_iter(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
cx: &LateContext<'_>,
|
||||
expr: &Expr<'_>,
|
||||
method_name: Symbol,
|
||||
receiver: &'tcx Expr<'tcx>,
|
||||
receiver: &Expr<'_>,
|
||||
cloned_before_iter: bool,
|
||||
) -> bool {
|
||||
if_chain! {
|
||||
|
|
@ -101,7 +101,7 @@ pub fn check_for_loop_iter(
|
|||
|
||||
/// The core logic of `check_for_loop_iter` above, this function wraps a use of
|
||||
/// `CloneOrCopyVisitor`.
|
||||
fn clone_or_copy_needed(
|
||||
fn clone_or_copy_needed<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
pat: &Pat<'tcx>,
|
||||
body: &'tcx Expr<'tcx>,
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ use std::cmp::max;
|
|||
|
||||
use super::UNNECESSARY_TO_OWNED;
|
||||
|
||||
pub fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol, args: &'tcx [Expr<'tcx>]) {
|
||||
pub fn check<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol, args: &'tcx [Expr<'tcx>]) {
|
||||
if_chain! {
|
||||
if let Some(method_def_id) = cx.typeck_results().type_dependent_def_id(expr.hir_id);
|
||||
if let [receiver] = args;
|
||||
|
|
@ -44,11 +44,11 @@ pub fn check(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>, method_name: Symbol
|
|||
/// call of a `to_owned`-like function is unnecessary.
|
||||
#[allow(clippy::too_many_lines)]
|
||||
fn check_addr_of_expr(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
cx: &LateContext<'_>,
|
||||
expr: &Expr<'_>,
|
||||
method_name: Symbol,
|
||||
method_def_id: DefId,
|
||||
receiver: &'tcx Expr<'tcx>,
|
||||
receiver: &Expr<'_>,
|
||||
) -> bool {
|
||||
if_chain! {
|
||||
if let Some(parent) = get_parent_expr(cx, expr);
|
||||
|
|
@ -171,12 +171,7 @@ fn check_addr_of_expr(
|
|||
|
||||
/// Checks whether `expr` is an argument in an `into_iter` call and, if so, determines whether its
|
||||
/// call of a `to_owned`-like function is unnecessary.
|
||||
fn check_into_iter_call_arg(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
method_name: Symbol,
|
||||
receiver: &'tcx Expr<'tcx>,
|
||||
) -> bool {
|
||||
fn check_into_iter_call_arg(cx: &LateContext<'_>, expr: &Expr<'_>, method_name: Symbol, receiver: &Expr<'_>) -> bool {
|
||||
if_chain! {
|
||||
if let Some(parent) = get_parent_expr(cx, expr);
|
||||
if let Some(callee_def_id) = fn_def_id(cx, parent);
|
||||
|
|
@ -221,7 +216,7 @@ fn check_into_iter_call_arg(
|
|||
|
||||
/// Checks whether `expr` is an argument in a function call and, if so, determines whether its call
|
||||
/// of a `to_owned`-like function is unnecessary.
|
||||
fn check_other_call_arg(
|
||||
fn check_other_call_arg<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
method_name: Symbol,
|
||||
|
|
@ -287,7 +282,7 @@ fn check_other_call_arg(
|
|||
|
||||
/// Walks an expression's ancestors until it finds a non-`AddrOf` expression. Returns the first such
|
||||
/// expression found (if any) along with the immediately prior expression.
|
||||
fn skip_addr_of_ancestors(
|
||||
fn skip_addr_of_ancestors<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
mut expr: &'tcx Expr<'tcx>,
|
||||
) -> Option<(&'tcx Expr<'tcx>, &'tcx Expr<'tcx>)> {
|
||||
|
|
@ -303,7 +298,7 @@ fn skip_addr_of_ancestors(
|
|||
|
||||
/// Checks whether an expression is a function or method call and, if so, returns its `DefId`,
|
||||
/// `Substs`, and arguments.
|
||||
fn get_callee_substs_and_args(
|
||||
fn get_callee_substs_and_args<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
expr: &'tcx Expr<'tcx>,
|
||||
) -> Option<(DefId, SubstsRef<'tcx>, &'tcx [Expr<'tcx>])> {
|
||||
|
|
@ -328,7 +323,7 @@ fn get_callee_substs_and_args(
|
|||
}
|
||||
|
||||
/// Returns the `TraitPredicate`s and `ProjectionPredicate`s for a function's input type.
|
||||
fn get_input_traits_and_projections(
|
||||
fn get_input_traits_and_projections<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
callee_def_id: DefId,
|
||||
input: Ty<'tcx>,
|
||||
|
|
@ -368,7 +363,11 @@ fn get_input_traits_and_projections(
|
|||
}
|
||||
|
||||
/// Composes two substitutions by applying the latter to the types of the former.
|
||||
fn compose_substs(cx: &LateContext<'tcx>, left: &[GenericArg<'tcx>], right: SubstsRef<'tcx>) -> Vec<GenericArg<'tcx>> {
|
||||
fn compose_substs<'tcx>(
|
||||
cx: &LateContext<'tcx>,
|
||||
left: &[GenericArg<'tcx>],
|
||||
right: SubstsRef<'tcx>,
|
||||
) -> Vec<GenericArg<'tcx>> {
|
||||
left.iter()
|
||||
.map(|arg| {
|
||||
if let GenericArgKind::Type(arg_ty) = arg.unpack() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue