Better error message when --config is given a table key and a non-inline-table value (#15266)

Co-authored-by: Micha Reiser <micha@reiser.io>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
InSync 2025-01-06 20:20:28 +07:00 committed by GitHub
parent f29c9e48a4
commit 832c0fa04b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 132 additions and 5 deletions

View file

@ -285,6 +285,22 @@ impl OptionSet {
None
}
}
pub fn collect_fields(&self) -> Vec<(String, OptionField)> {
struct FieldsCollector(Vec<(String, OptionField)>);
impl Visit for FieldsCollector {
fn record_field(&mut self, name: &str, field: OptionField) {
self.0.push((name.to_string(), field));
}
fn record_set(&mut self, _name: &str, _group: OptionSet) {}
}
let mut visitor = FieldsCollector(vec![]);
self.record(&mut visitor);
visitor.0
}
}
/// Visitor that writes out the names of all fields and sets.