mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-11-27 15:11:30 +00:00
Replace Body::basic_blocks()
with field access
This commit is contained in:
parent
2cdc54d265
commit
e4eddc611a
2 changed files with 4 additions and 4 deletions
|
@ -105,7 +105,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
|
|||
vis.into_map(cx, maybe_storage_live_result)
|
||||
};
|
||||
|
||||
for (bb, bbdata) in mir.basic_blocks().iter_enumerated() {
|
||||
for (bb, bbdata) in mir.basic_blocks.iter_enumerated() {
|
||||
let terminator = bbdata.terminator();
|
||||
|
||||
if terminator.source_info.span.from_expansion() {
|
||||
|
@ -186,7 +186,7 @@ impl<'tcx> LateLintPass<'tcx> for RedundantClone {
|
|||
unwrap_or_continue!(find_stmt_assigns_to(cx, mir, pred_arg, true, ps[0]));
|
||||
let loc = mir::Location {
|
||||
block: bb,
|
||||
statement_index: mir.basic_blocks()[bb].statements.len(),
|
||||
statement_index: mir.basic_blocks[bb].statements.len(),
|
||||
};
|
||||
|
||||
// This can be turned into `res = move local` if `arg` and `cloned` are not borrowed
|
||||
|
@ -310,7 +310,7 @@ fn find_stmt_assigns_to<'tcx>(
|
|||
by_ref: bool,
|
||||
bb: mir::BasicBlock,
|
||||
) -> Option<(mir::Local, CannotMoveOut)> {
|
||||
let rvalue = mir.basic_blocks()[bb].statements.iter().rev().find_map(|stmt| {
|
||||
let rvalue = mir.basic_blocks[bb].statements.iter().rev().find_map(|stmt| {
|
||||
if let mir::StatementKind::Assign(box (mir::Place { local, .. }, v)) = &stmt.kind {
|
||||
return if *local == to_local { Some(v) } else { None };
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ pub fn is_min_const_fn<'a, 'tcx>(tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, msrv:
|
|||
body.local_decls.iter().next().unwrap().source_info.span,
|
||||
)?;
|
||||
|
||||
for bb in body.basic_blocks() {
|
||||
for bb in body.basic_blocks.iter() {
|
||||
check_terminator(tcx, body, bb.terminator(), msrv)?;
|
||||
for stmt in &bb.statements {
|
||||
check_statement(tcx, body, def_id, stmt)?;
|
||||
|
|
Loading…
Reference in a new issue