}
// Give up on loops
- if terminator.successors().any(|s| *s == bb) {
+ if terminator.successors().any(|s| s == bb) {
continue;
}
diag.span_suggestion(
sugg_span,
"remove this",
- String::new(),
+ "",
app,
);
if clone_usage.cloned_used {
if let mir::TerminatorKind::Call { func, args, destination, .. } = kind;
if args.len() == 1;
if let mir::Operand::Move(mir::Place { local, .. }) = &args[0];
- if let ty::FnDef(def_id, _) = *func.ty(&*mir, cx.tcx).kind();
- if let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].ty(&*mir, cx.tcx));
+ if let ty::FnDef(def_id, _) = *func.ty(mir, cx.tcx).kind();
+ if let (inner_ty, 1) = walk_ptrs_ty_depth(args[0].ty(mir, cx.tcx));
if !is_copy(cx, inner_ty);
then {
- Some((def_id, *local, inner_ty, destination.as_ref().map(|(dest, _)| dest)?.as_local()?))
+ Some((def_id, *local, inner_ty, destination.as_local()?))
} else {
None
}
None
})?;
- match (by_ref, &*rvalue) {
+ match (by_ref, rvalue) {
(true, mir::Rvalue::Ref(_, _, place)) | (false, mir::Rvalue::Use(mir::Operand::Copy(place))) => {
Some(base_local_and_movability(cx, mir, *place))
},
// Short-circuit
if (usage.cloned_used && usage.clone_consumed_or_mutated) ||
// Give up on loops
- tdata.terminator().successors().any(|s| *s == bb)
+ tdata.terminator().successors().any(|s| s == bb)
{
return CloneUsage {
cloned_used: true,
fn visit_terminator(&mut self, terminator: &mir::Terminator<'_>, _loc: mir::Location) {
if let mir::TerminatorKind::Call {
args,
- destination: Some((mir::Place { local: dest, .. }, _)),
+ destination: mir::Place { local: dest, .. },
..
} = &terminator.kind
{
}
/// Collect possible borrowed for every `&mut` local.
-/// For exampel, `_1 = &mut _2` generate _1: {_2,...}
+/// For example, `_1 = &mut _2` generate _1: {_2,...}
/// Known Problems: not sure all borrowed are tracked
struct PossibleOriginVisitor<'a, 'tcx> {
possible_origin: TransitiveRelation,