Skip to content

Commit

Permalink
Replace Body::basic_blocks() with field access
Browse files Browse the repository at this point in the history
  • Loading branch information
tmiasko committed Aug 26, 2022
1 parent 2cdc54d commit e4eddc6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions clippy_lints/src/redundant_clone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 };
}
Expand Down
2 changes: 1 addition & 1 deletion clippy_utils/src/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
Expand Down

0 comments on commit e4eddc6

Please sign in to comment.