Trivially simplify rust_language::print_enum

rust_language::print_enum computes:

  int nfields = variant_type->num_fields ();

... but then does not reuse this in one spot.  This patch corrects the
oversight.
This commit is contained in:
Tom Tromey
2023-02-09 12:13:08 -07:00
parent b695fdd9b2
commit 8ac460b742

View File

@ -495,7 +495,7 @@ rust_language::print_enum (struct value *val, struct ui_file *stream,
}
bool first_field = true;
for (int j = 0; j < variant_type->num_fields (); j++)
for (int j = 0; j < nfields; j++)
{
if (!first_field)
gdb_puts (", ", stream);