mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-29 13:25:17 +00:00
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:
parent
f29c9e48a4
commit
832c0fa04b
3 changed files with 132 additions and 5 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue