Skip to content

Commit 595ccac

Browse files
committed
Remove unused variable assignments
Multiple local variables were not read beyond their assignments. gcc/rust/ChangeLog: * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Remove unused assignment. * typecheck/rust-hir-type-check-path.cc (TypeCheckExpr::resolve_segments): Likewise. * typecheck/rust-tyty.cc (ParamType::handle_substitions): Likewise. * typecheck/rust-unify.cc (UnifyRules::go): Likewise. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
1 parent 82301b7 commit 595ccac

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

gcc/rust/typecheck/rust-hir-type-check-expr.cc

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,10 +629,9 @@ TypeCheckExpr::visit (HIR::BlockExpr &expr)
629629
if (s->is_unit_check_needed () && !resolved->is_unit ())
630630
{
631631
auto unit = TyTy::TupleType::get_unit_type ();
632-
resolved
633-
= unify_site (s->get_mappings ().get_hirid (),
634-
TyTy::TyWithLocation (unit),
635-
TyTy::TyWithLocation (resolved), s->get_locus ());
632+
unify_site (s->get_mappings ().get_hirid (),
633+
TyTy::TyWithLocation (unit),
634+
TyTy::TyWithLocation (resolved), s->get_locus ());
636635
}
637636
}
638637

gcc/rust/typecheck/rust-hir-type-check-path.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,8 @@ TypeCheckExpr::resolve_segments (NodeId root_resolved_node_id,
517517
const auto &predicate
518518
= impl_block_ty->lookup_predicate (trait_ref.get_defid ());
519519
if (!predicate.is_error ())
520-
impl_block_ty
521-
= associated->setup_associated_types (prev_segment, predicate,
522-
nullptr, false);
520+
associated->setup_associated_types (prev_segment, predicate,
521+
nullptr, false);
523522
}
524523
}
525524

gcc/rust/typecheck/rust-tyty.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3566,7 +3566,7 @@ ParamType::handle_substitions (SubstitutionArgumentMappings &subst_mappings)
35663566
{
35673567
const ParamType &pp = *static_cast<const ParamType *> (resolved);
35683568
if (pp.can_resolve ())
3569-
resolved = pp.resolve ();
3569+
pp.resolve ();
35703570
}
35713571

35723572
// this is the new subst that this needs to pass

gcc/rust/typecheck/rust-unify.cc

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,8 @@ UnifyRules::emit_abi_mismatch (const TyTy::FnType &expected,
155155
TyTy::BaseType *
156156
UnifyRules::go ()
157157
{
158-
TyTy::BaseType *ltype = lhs.get_ty ();
159-
TyTy::BaseType *rtype = rhs.get_ty ();
160-
161-
ltype = lhs.get_ty ()->destructure ();
162-
rtype = rhs.get_ty ()->destructure ();
158+
TyTy::BaseType *ltype = lhs.get_ty ()->destructure ();
159+
TyTy::BaseType *rtype = rhs.get_ty ()->destructure ();
163160

164161
rust_debug ("unify::go ltype={%s} rtype={%s}", ltype->debug_str ().c_str (),
165162
rtype->debug_str ().c_str ());

0 commit comments

Comments
 (0)