From 8ac460b742bc7f49acbcd78f8822386f56814055 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 9 Feb 2023 12:13:08 -0700 Subject: [PATCH] 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. --- gdb/rust-lang.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.30.2