}
}
-struct ExprVisitor<'a, 'tcx: 'a> {
+struct ExprVisitor<'a, 'tcx> {
assignee: &'a hir::Expr,
counter: u8,
cx: &'a LateContext<'a, 'tcx>,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ExprVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
if SpanlessEq::new(self.cx).ignore_fn().eq_expr(self.assignee, expr) {
self.counter += 1;
declare_lint_pass!(BlockInIfCondition => [BLOCK_IN_IF_CONDITION_EXPR, BLOCK_IN_IF_CONDITION_STMT]);
-struct ExVisitor<'a, 'tcx: 'a> {
+struct ExVisitor<'a, 'tcx> {
found_block: Option<&'tcx Expr>,
cx: &'a LateContext<'a, 'tcx>,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ExVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
if let ExprKind::Closure(_, _, eid, _, _) = expr.node {
let body = self.cx.tcx.hir().body(eid);
}
}
-struct NonminimalBoolVisitor<'a, 'tcx: 'a> {
+struct NonminimalBoolVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
}
use quine_mc_cluskey::Bool;
-struct Hir2Qmm<'a, 'tcx: 'a, 'v> {
+struct Hir2Qmm<'a, 'tcx, 'v> {
terminals: Vec<&'v Expr>,
cx: &'a LateContext<'a, 'tcx>,
}
}
}
-struct SuggestContext<'a, 'tcx: 'a, 'v> {
+struct SuggestContext<'a, 'tcx, 'v> {
terminals: &'v [&'v Expr],
cx: &'a LateContext<'a, 'tcx>,
output: String,
impl_lint_pass!(CognitiveComplexity => [COGNITIVE_COMPLEXITY]);
impl CognitiveComplexity {
- fn check<'a, 'tcx: 'a>(&mut self, cx: &'a LateContext<'a, 'tcx>, body: &'tcx Body, span: Span) {
+ fn check<'a, 'tcx>(&mut self, cx: &'a LateContext<'a, 'tcx>, body: &'tcx Body, span: Span) {
if in_macro_or_desugar(span) {
return;
}
}
}
-struct CCHelper<'a, 'tcx: 'a> {
+struct CCHelper<'a, 'tcx> {
match_arms: u64,
divergence: u64,
returns: u64,
}
}
-pub struct ConstEvalLateContext<'a, 'tcx: 'a> {
+pub struct ConstEvalLateContext<'a, 'tcx> {
lcx: &'a LateContext<'a, 'tcx>,
tables: &'a ty::TypeckTables<'tcx>,
param_env: ty::ParamEnv<'tcx>,
None
}
-struct InsertVisitor<'a, 'tcx: 'a, 'b> {
+struct InsertVisitor<'a, 'tcx, 'b> {
cx: &'a LateContext<'a, 'tcx>,
span: Span,
ty: &'static str,
ty.is_box() && !ty.boxed_ty().is_trait()
}
-struct EscapeDelegate<'a, 'tcx: 'a> {
+struct EscapeDelegate<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
set: HirIdSet,
too_large_for_stack: u64,
}
}
-struct DivergenceVisitor<'a, 'tcx: 'a> {
+struct DivergenceVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
}
}
/// A visitor that looks for reads from a variable.
-struct ReadVisitor<'a, 'tcx: 'a> {
+struct ReadVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
/// The ID of the variable we're looking for.
var: HirId,
use rustc::hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc::hir::*;
- struct FindPanicUnwrap<'a, 'tcx: 'a> {
+ struct FindPanicUnwrap<'a, 'tcx> {
lcx: &'a LateContext<'a, 'tcx>,
tables: &'tcx ty::TypeckTables<'tcx>,
result: Vec<Span>,
}
- impl<'a, 'tcx: 'a> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
+ impl<'a, 'tcx> Visitor<'tcx> for FindPanicUnwrap<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
// check for `begin_panic`
if_chain! {
}
}
-struct DerefVisitor<'a, 'tcx: 'a> {
+struct DerefVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
ptrs: FxHashSet<hir::HirId>,
tables: &'a ty::TypeckTables<'tcx>,
}
}
-impl<'a, 'tcx: 'a> DerefVisitor<'a, 'tcx> {
+impl<'a, 'tcx> DerefVisitor<'a, 'tcx> {
fn check_arg(&self, ptr: &hir::Expr) {
if let hir::ExprKind::Path(ref qpath) = ptr.node {
if let Res::Local(id) = self.cx.tables.qpath_res(qpath, ptr.hir_id) {
}
}
-struct UsedVisitor<'a, 'tcx: 'a> {
+struct UsedVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
id: hir::HirId,
used: bool,
None
}
-fn used_in_expr<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, id: hir::HirId, expr: &'tcx hir::Expr) -> bool {
+fn used_in_expr<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, id: hir::HirId, expr: &'tcx hir::Expr) -> bool {
let mut v = UsedVisitor { cx, id, used: false };
hir::intravisit::walk_expr(&mut v, expr);
v.used
report_extra_lifetimes(cx, decl, generics);
}
-fn could_use_elision<'a, 'tcx: 'a>(
+fn could_use_elision<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
func: &'tcx FnDecl,
body: Option<BodyId>,
}
/// A visitor usable for `rustc_front::visit::walk_ty()`.
-struct RefVisitor<'a, 'tcx: 'a> {
+struct RefVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
lts: Vec<RefLt>,
abort: bool,
/// Are any lifetimes mentioned in the `where` clause? If so, we don't try to
/// reason about elision.
-fn has_where_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause) -> bool {
+fn has_where_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, where_clause: &'tcx WhereClause) -> bool {
for predicate in &where_clause.predicates {
match *predicate {
WherePredicate::RegionPredicate(..) => return true,
}
}
-fn report_extra_lifetimes<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, generics: &'tcx Generics) {
+fn report_extra_lifetimes<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, func: &'tcx FnDecl, generics: &'tcx Generics) {
let hs = generics
.params
.iter()
}
}
-struct LocalUsedVisitor<'a, 'tcx: 'a> {
+struct LocalUsedVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
local: HirId,
used: bool,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for LocalUsedVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for LocalUsedVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
if same_var(self.cx, expr, self.local) {
self.used = true;
}
}
-struct VarVisitor<'a, 'tcx: 'a> {
+struct VarVisitor<'a, 'tcx> {
/// context reference
cx: &'a LateContext<'a, 'tcx>,
/// var name to look for as index
}
}
-fn is_used_inside<'a, 'tcx: 'a>(cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr, container: &'tcx Expr) -> bool {
+fn is_used_inside<'a, 'tcx>(cx: &'a LateContext<'a, 'tcx>, expr: &'tcx Expr, container: &'tcx Expr) -> bool {
let def_id = match var_def_id(cx, expr) {
Some(id) => id,
None => return false,
false
}
-fn is_iterator_used_after_while_let<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, iter_expr: &'tcx Expr) -> bool {
+fn is_iterator_used_after_while_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, iter_expr: &'tcx Expr) -> bool {
let def_id = match var_def_id(cx, iter_expr) {
Some(id) => id,
None => return false,
visitor.var_used_after_while_let
}
-struct VarUsedAfterLoopVisitor<'a, 'tcx: 'a> {
+struct VarUsedAfterLoopVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
def_id: HirId,
iter_expr_id: HirId,
}
/// Scan a for loop for variables that are incremented exactly once.
-struct IncrementVisitor<'a, 'tcx: 'a> {
+struct IncrementVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>, // context reference
states: FxHashMap<HirId, VarState>, // incremented variables
depth: u32, // depth of conditional expressions
}
/// Checks whether a variable is initialized to zero at the start of a loop.
-struct InitializeVisitor<'a, 'tcx: 'a> {
+struct InitializeVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>, // context reference
end_expr: &'tcx Expr, // the for loop. Stop scanning here.
var_id: HirId,
/// Stops analysis if a function call is found
/// Note: In some cases such as `self`, there are no mutable annotation,
/// All variables definition IDs are collected
-struct VarCollectorVisitor<'a, 'tcx: 'a> {
+struct VarCollectorVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
ids: FxHashSet<HirId>,
def_ids: FxHashMap<def_id::DefId, bool>,
T: Copy + Ord,
{
#[derive(Copy, Clone, Debug, Eq, PartialEq)]
- enum Kind<'a, T: 'a> {
+ enum Kind<'a, T> {
Start(T, &'a SpannedRange<T>),
End(Bound<T>, &'a SpannedRange<T>),
}
/// Checks for the `OR_FUN_CALL` lint.
#[allow(clippy::too_many_lines)]
-fn lint_or_fun_call<'a, 'tcx: 'a>(
+fn lint_or_fun_call<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
expr: &hir::Expr,
method_span: Span,
args: &'tcx [hir::Expr],
) {
// Searches an expression for method calls or function calls that aren't ctors
- struct FunCallFinder<'a, 'tcx: 'a> {
+ struct FunCallFinder<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
found: bool,
}
/// Checks for `*or(foo())`.
#[allow(clippy::too_many_arguments)]
- fn check_general_case<'a, 'tcx: 'a>(
+ fn check_general_case<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
name: &str,
method_span: Span,
}
}
-struct UnwrapVisitor<'a, 'tcx: 'a> {
+struct UnwrapVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
identifiers: FxHashSet<Symbol>,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnwrapVisitor<'a, 'tcx> {
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
self.identifiers.insert(ident(path));
walk_path(self, path);
}
}
-struct MapExprVisitor<'a, 'tcx: 'a> {
+struct MapExprVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
identifiers: FxHashSet<Symbol>,
found_identifier: bool,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for MapExprVisitor<'a, 'tcx> {
fn visit_path(&mut self, path: &'tcx Path, _id: HirId) {
if self.identifiers.contains(&ident(path)) {
self.found_identifier = true;
}
// returns (found_mapping, found_filtering)
-fn check_expression<'a, 'tcx: 'a>(
+fn check_expression<'a, 'tcx>(
cx: &'a LateContext<'a, 'tcx>,
arg_id: hir::HirId,
expr: &'tcx hir::Expr,
}
}
-struct ReturnVisitor<'a, 'tcx: 'a> {
+struct ReturnVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
arg_id: hir::HirId,
// Found a non-None return that isn't Some(input)
found_filtering: bool,
}
-impl<'a, 'tcx: 'a> ReturnVisitor<'a, 'tcx> {
+impl<'a, 'tcx> ReturnVisitor<'a, 'tcx> {
fn new(cx: &'a LateContext<'a, 'tcx>, arg_id: hir::HirId) -> ReturnVisitor<'a, 'tcx> {
ReturnVisitor {
cx,
}
}
-pub struct MutVisitor<'a, 'tcx: 'a> {
+pub struct MutVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
}
})
}
-struct MovedVariablesCtxt<'a, 'tcx: 'a> {
+struct MovedVariablesCtxt<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
moved_vars: FxHashSet<HirId>,
/// Spans which need to be prefixed with `*` for dereferencing the
whitelist: &'static [&'static str],
}
-struct SimilarNamesLocalVisitor<'a, 'tcx: 'a> {
+struct SimilarNamesLocalVisitor<'a, 'tcx> {
names: Vec<ExistingName>,
cx: &'a EarlyContext<'tcx>,
lint: &'a NonExpressiveNames,
single_char_names: Vec<Vec<Ident>>,
}
-impl<'a, 'tcx: 'a> SimilarNamesLocalVisitor<'a, 'tcx> {
+impl<'a, 'tcx> SimilarNamesLocalVisitor<'a, 'tcx> {
fn check_single_char_names(&self) {
let num_single_char_names = self.single_char_names.iter().flatten().count();
let threshold = self.lint.single_char_binding_names_threshold;
&["lit", "lint"],
];
-struct SimilarNamesNameVisitor<'a: 'b, 'tcx: 'a, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
+struct SimilarNamesNameVisitor<'a, 'tcx, 'b>(&'b mut SimilarNamesLocalVisitor<'a, 'tcx>);
-impl<'a, 'tcx: 'a, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
+impl<'a, 'tcx, 'b> Visitor<'tcx> for SimilarNamesNameVisitor<'a, 'tcx, 'b> {
fn visit_pat(&mut self, pat: &'tcx Pat) {
match pat.node {
PatKind::Ident(_, ident, _) => self.check_ident(ident),
}
}
-fn lint_shadow<'a, 'tcx: 'a>(
+fn lint_shadow<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
name: Name,
span: Span,
/// `VectorInitializationVisitor` searches for unsafe or slow vector initializations for the given
/// vector.
-struct VectorInitializationVisitor<'a, 'tcx: 'a> {
+struct VectorInitializationVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
/// Contains the information.
in_binary_expr: bool,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for BinaryExprVisitor {
+impl<'a, 'tcx> Visitor<'tcx> for BinaryExprVisitor {
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
match expr.node {
hir::ExprKind::Binary(..)
}
}
-struct ImplicitHasherTypeVisitor<'a, 'tcx: 'a> {
+struct ImplicitHasherTypeVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
found: Vec<ImplicitHasherType<'tcx>>,
}
-impl<'a, 'tcx: 'a> ImplicitHasherTypeVisitor<'a, 'tcx> {
+impl<'a, 'tcx> ImplicitHasherTypeVisitor<'a, 'tcx> {
fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
Self { cx, found: vec![] }
}
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for ImplicitHasherTypeVisitor<'a, 'tcx> {
fn visit_ty(&mut self, t: &'tcx hir::Ty) {
if let Some(target) = ImplicitHasherType::new(self.cx, t) {
self.found.push(target);
}
/// Looks for default-hasher-dependent constructors like `HashMap::new`.
-struct ImplicitHasherConstructorVisitor<'a, 'b, 'tcx: 'a + 'b> {
+struct ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
body: &'a TypeckTables<'tcx>,
target: &'b ImplicitHasherType<'tcx>,
suggestions: BTreeMap<Span, String>,
}
-impl<'a, 'b, 'tcx: 'a + 'b> ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
+impl<'a, 'b, 'tcx> ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
fn new(cx: &'a LateContext<'a, 'tcx>, target: &'b ImplicitHasherType<'tcx>) -> Self {
Self {
cx,
}
}
-impl<'a, 'b, 'tcx: 'a + 'b> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
+impl<'a, 'b, 'tcx> Visitor<'tcx> for ImplicitHasherConstructorVisitor<'a, 'b, 'tcx> {
fn visit_body(&mut self, body: &'tcx Body) {
let prev_body = self.body;
self.body = self.cx.tcx.body_tables(body.id());
"unused labels"
}
-struct UnusedLabelVisitor<'a, 'tcx: 'a> {
+struct UnusedLabelVisitor<'a, 'tcx> {
labels: FxHashMap<LocalInternedString, Span>,
cx: &'a LateContext<'a, 'tcx>,
}
}
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnusedLabelVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx hir::Expr) {
match expr.node {
hir::ExprKind::Break(destination, _) | hir::ExprKind::Continue(destination) => {
}
/// Visitor that keeps track of which variables are unwrappable.
-struct UnwrappableVariablesVisitor<'a, 'tcx: 'a> {
+struct UnwrappableVariablesVisitor<'a, 'tcx> {
unwrappables: Vec<UnwrapInfo<'tcx>>,
cx: &'a LateContext<'a, 'tcx>,
}
/// Collects the information about unwrappable variables from an if condition
/// The `invert` argument tells us whether the condition is negated.
-fn collect_unwrap_info<'a, 'tcx: 'a>(
+fn collect_unwrap_info<'a, 'tcx>(
cx: &'a LateContext<'a, 'tcx>,
expr: &'tcx Expr,
invert: bool,
Vec::new()
}
-impl<'a, 'tcx: 'a> UnwrappableVariablesVisitor<'a, 'tcx> {
+impl<'a, 'tcx> UnwrappableVariablesVisitor<'a, 'tcx> {
fn visit_branch(&mut self, cond: &'tcx Expr, branch: &'tcx Expr, else_branch: bool) {
let prev_len = self.unwrappables.len();
for unwrap_info in collect_unwrap_info(self.cx, cond, else_branch) {
}
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for UnwrappableVariablesVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
if let Some((cond, then, els)) = if_block(&expr) {
walk_expr(self, cond);
);
}
-struct TraitImplTyVisitor<'a, 'tcx: 'a> {
+struct TraitImplTyVisitor<'a, 'tcx> {
item_type: Ty<'tcx>,
cx: &'a LateContext<'a, 'tcx>,
trait_type_walker: ty::walk::TypeWalker<'tcx>,
}
}
-fn check_trait_method_impl_decl<'a, 'tcx: 'a>(
+fn check_trait_method_impl_decl<'a, 'tcx>(
cx: &'a LateContext<'a, 'tcx>,
item_type: Ty<'tcx>,
impl_item: &ImplItem,
}
}
-struct UseSelfVisitor<'a, 'tcx: 'a> {
+struct UseSelfVisitor<'a, 'tcx> {
item_path: &'a Path,
cx: &'a LateContext<'a, 'tcx>,
}
/// span.
///
/// Note that some expressions kinds are not considered but could be added.
-pub struct SpanlessEq<'a, 'tcx: 'a> {
+pub struct SpanlessEq<'a, 'tcx> {
/// Context used to evaluate constant expressions.
cx: &'a LateContext<'a, 'tcx>,
tables: &'a TypeckTables<'tcx>,
ignore_fn: bool,
}
-impl<'a, 'tcx: 'a> SpanlessEq<'a, 'tcx> {
+impl<'a, 'tcx> SpanlessEq<'a, 'tcx> {
pub fn new(cx: &'a LateContext<'a, 'tcx>) -> Self {
Self {
cx,
/// trait would consider IDs and spans.
///
/// All expressions kind are hashed, but some might have a weaker hash.
-pub struct SpanlessHash<'a, 'tcx: 'a> {
+pub struct SpanlessHash<'a, 'tcx> {
/// Context used to evaluate constant expressions.
cx: &'a LateContext<'a, 'tcx>,
tables: &'a TypeckTables<'tcx>,
s: DefaultHasher,
}
-impl<'a, 'tcx: 'a> SpanlessHash<'a, 'tcx> {
+impl<'a, 'tcx> SpanlessHash<'a, 'tcx> {
pub fn new(cx: &'a LateContext<'a, 'tcx>, tables: &'a TypeckTables<'tcx>) -> Self {
Self {
cx,
false
}
-struct LintCollector<'a, 'tcx: 'a> {
+struct LintCollector<'a, 'tcx> {
output: &'a mut FxHashSet<Name>,
cx: &'a LateContext<'a, 'tcx>,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for LintCollector<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for LintCollector<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
walk_expr(self, expr);
}
})
}
-pub fn get_enclosing_block<'a, 'tcx: 'a>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> {
+pub fn get_enclosing_block<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, hir_id: HirId) -> Option<&'tcx Block> {
let map = &cx.tcx.hir();
let enclosing_node = map
.get_enclosing_scope(hir_id)
}
}
-fn extract_clone_suggestions<'a, 'tcx: 'a>(
+fn extract_clone_suggestions<'a, 'tcx>(
cx: &LateContext<'a, 'tcx>,
name: Name,
replace: &[(&'static str, &'static str)],
}
}
-struct PtrCloneVisitor<'a, 'tcx: 'a> {
+struct PtrCloneVisitor<'a, 'tcx> {
cx: &'a LateContext<'a, 'tcx>,
name: Name,
replace: &'a [(&'static str, &'static str)],
abort: bool,
}
-impl<'a, 'tcx: 'a> Visitor<'tcx> for PtrCloneVisitor<'a, 'tcx> {
+impl<'a, 'tcx> Visitor<'tcx> for PtrCloneVisitor<'a, 'tcx> {
fn visit_expr(&mut self, expr: &'tcx Expr) {
if self.abort {
return;
use syntax::source_map::Span;
/// Returns a set of mutated local variable IDs, or `None` if mutations could not be determined.
-pub fn mutated_variables<'a, 'tcx: 'a>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<FxHashSet<HirId>> {
+pub fn mutated_variables<'a, 'tcx>(expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> Option<FxHashSet<HirId>> {
let mut delegate = MutVarsDelegate {
used_mutably: FxHashSet::default(),
skip: false,
Some(delegate.used_mutably)
}
-pub fn is_potentially_mutated<'a, 'tcx: 'a>(
- variable: &'tcx Path,
- expr: &'tcx Expr,
- cx: &'a LateContext<'a, 'tcx>,
-) -> bool {
+pub fn is_potentially_mutated<'a, 'tcx>(variable: &'tcx Path, expr: &'tcx Expr, cx: &'a LateContext<'a, 'tcx>) -> bool {
if let Res::Local(id) = variable.res {
mutated_variables(expr, cx).map_or(true, |mutated| mutated.contains(&id))
} else {
}
#[derive(Default)]
-pub struct OptionRefWrapper<'a, T: 'a>(Option<&'a T>);
+pub struct OptionRefWrapper<'a, T>(Option<&'a T>);
-impl<'a, T: 'a> OptionRefWrapper<'a, T> {
+impl<'a, T> OptionRefWrapper<'a, T> {
pub fn new() -> Self {
OptionRefWrapper(None)
}
#[warn(clippy::transmute_ptr_to_ref)]
fn issue1231() {
- struct Foo<'a, T: 'a> {
+ struct Foo<'a, T> {
bar: &'a T,
}