Run util/dev fmt
This commit is contained in:
parent
3b23092b69
commit
3aa531c194
4 changed files with 11 additions and 35 deletions
|
|
@ -78,15 +78,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoxedLocal {
|
|||
|
||||
let fn_def_id = cx.tcx.hir().local_def_id(hir_id);
|
||||
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||
ExprUseVisitor::new(
|
||||
&mut v,
|
||||
cx.tcx,
|
||||
fn_def_id,
|
||||
cx.param_env,
|
||||
region_scope_tree,
|
||||
cx.tables,
|
||||
)
|
||||
.consume_body(body);
|
||||
ExprUseVisitor::new(&mut v, cx.tcx, fn_def_id, cx.param_env, region_scope_tree, cx.tables).consume_body(body);
|
||||
|
||||
for node in v.set {
|
||||
span_lint(
|
||||
|
|
@ -145,11 +137,7 @@ impl<'a, 'tcx> Delegate<'tcx> for EscapeDelegate<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn borrow(
|
||||
&mut self,
|
||||
cmt: &cmt_<'tcx>,
|
||||
_: ty::BorrowKind,
|
||||
) {
|
||||
fn borrow(&mut self, cmt: &cmt_<'tcx>, _: ty::BorrowKind) {
|
||||
if let Categorization::Local(lid) = cmt.cat {
|
||||
self.set.remove(&lid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,11 +21,11 @@ use syntax::symbol::{sym, LocalInternedString, Symbol};
|
|||
use crate::utils::usage::mutated_variables;
|
||||
use crate::utils::{
|
||||
get_arg_name, get_parent_expr, get_trait_def_id, has_iter_method, implements_trait, in_macro, is_copy,
|
||||
is_ctor_or_promotable_const_function, is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment, match_def_path,
|
||||
match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths, remove_blocks,
|
||||
return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability, snippet_with_macro_callsite,
|
||||
span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then, span_note_and_lint, sugg, walk_ptrs_ty,
|
||||
walk_ptrs_ty_depth, SpanlessEq,
|
||||
is_ctor_or_promotable_const_function, is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment,
|
||||
match_def_path, match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths,
|
||||
remove_blocks, return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability,
|
||||
snippet_with_macro_callsite, span_help_and_lint, span_lint, span_lint_and_sugg, span_lint_and_then,
|
||||
span_note_and_lint, sugg, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq,
|
||||
};
|
||||
|
||||
declare_clippy_lint! {
|
||||
|
|
|
|||
|
|
@ -136,15 +136,8 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue {
|
|||
} = {
|
||||
let mut ctx = MovedVariablesCtxt::default();
|
||||
let region_scope_tree = &cx.tcx.region_scope_tree(fn_def_id);
|
||||
euv::ExprUseVisitor::new(
|
||||
&mut ctx,
|
||||
cx.tcx,
|
||||
fn_def_id,
|
||||
cx.param_env,
|
||||
region_scope_tree,
|
||||
cx.tables,
|
||||
)
|
||||
.consume_body(body);
|
||||
euv::ExprUseVisitor::new(&mut ctx, cx.tcx, fn_def_id, cx.param_env, region_scope_tree, cx.tables)
|
||||
.consume_body(body);
|
||||
ctx
|
||||
};
|
||||
|
||||
|
|
@ -349,12 +342,7 @@ impl<'tcx> euv::Delegate<'tcx> for MovedVariablesCtxt {
|
|||
}
|
||||
}
|
||||
|
||||
fn borrow(
|
||||
&mut self,
|
||||
_: &mc::cmt_<'tcx>,
|
||||
_: ty::BorrowKind,
|
||||
) {
|
||||
}
|
||||
fn borrow(&mut self, _: &mc::cmt_<'tcx>, _: ty::BorrowKind) {}
|
||||
|
||||
fn mutate(&mut self, _: &mc::cmt_<'tcx>) {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -811,7 +811,7 @@ pub fn is_ctor_or_promotable_const_function(cx: &LateContext<'_, '_>, expr: &Exp
|
|||
def::Res::Def(DefKind::Variant, ..) | Res::Def(DefKind::Ctor(..), _) => true,
|
||||
def::Res::Def(_, def_id) => cx.tcx.is_promotable_const_fn(def_id),
|
||||
_ => false,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
false
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue