From 01b51b62eeed92f89f31359e6b00871df5741729 Mon Sep 17 00:00:00 2001 From: ychenfo Date: Fri, 12 Nov 2021 02:25:53 +0800 Subject: [PATCH] nac3core: composer better error msg in for uninit field --- nac3core/src/toplevel/composer.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/nac3core/src/toplevel/composer.rs b/nac3core/src/toplevel/composer.rs index 9c23930e..e7c17cd0 100644 --- a/nac3core/src/toplevel/composer.rs +++ b/nac3core/src/toplevel/composer.rs @@ -1646,11 +1646,14 @@ impl TopLevelComposer { unreachable!("must be init function here") } let all_inited = Self::get_all_assigned_field(body.as_slice())?; - if fields.iter().any(|x| !all_inited.contains(&x.0)) { - return Err(format!( - "fields of class {} not fully initialized", - class_name - )); + for (f, _, _) in fields { + if !all_inited.contains(f) { + return Err(format!( + "fields `{}` of class `{}` not fully initialized", + f, + class_name + )); + } } } }