From: Tom Tromey Date: Thu, 9 Feb 2023 19:13:08 +0000 (-0700) Subject: Trivially simplify rust_language::print_enum X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ac460b742bc7f49acbcd78f8822386f56814055;p=binutils-gdb.git 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. --- diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c index 6653f7a9c64..f2017f95211 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);