aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-02-09 12:13:08 -0700
committerTom Tromey <tom@tromey.com>2023-02-09 12:17:13 -0700
commit8ac460b742bc7f49acbcd78f8822386f56814055 (patch)
tree76fc4392125ae23b7c8985f49b6ca26925571df4
parentb695fdd9b2494a64db1fb8e584753a1a5afec494 (diff)
downloadgdb-8ac460b742bc7f49acbcd78f8822386f56814055.zip
gdb-8ac460b742bc7f49acbcd78f8822386f56814055.tar.gz
gdb-8ac460b742bc7f49acbcd78f8822386f56814055.tar.bz2
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.
-rw-r--r--gdb/rust-lang.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 6653f7a..f2017f9 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -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);