Problem
The build_green_tree function currently has too many arguments (7 parameters), triggering a clippy warning that requires suppression with #[expect(clippy::too_many_arguments)].
Current Signature
fn build_green_tree(
tokens: Vec<(SyntaxKind, Span)>,
src: &str,
imports: &[Span],
typedefs: &[Span],
relations: &[Span],
indexes: &[Span],
functions: &[Span],
rules: &[Span],
) -> GreenNode
Proposed Solution
Group the related span parameters into a meaningful struct:
struct ParsedSpans {
imports: Vec<Span>,
typedefs: Vec<Span>,
relations: Vec<Span>,
indexes: Vec<Span>,
functions: Vec<Span>,
rules: Vec<Span>,
}
fn build_green_tree(
tokens: Vec<(SyntaxKind, Span)>,
src: &str,
spans: &ParsedSpans,
) -> GreenNode
This approach:
- Reduces function arguments from 8 to 3
- Groups related parameters meaningfully
- Eliminates the need for clippy warning suppression
- Follows better coding practices for parameter management
Implementation Notes
- Update all calls to
build_green_tree to use the new struct
- Update
parse_tokens function to return the struct instead of a tuple
- Ensure all span-related operations work with the new structure
References
Problem
The
build_green_treefunction currently has too many arguments (7 parameters), triggering a clippy warning that requires suppression with#[expect(clippy::too_many_arguments)].Current Signature
Proposed Solution
Group the related span parameters into a meaningful struct:
This approach:
Implementation Notes
build_green_treeto use the new structparse_tokensfunction to return the struct instead of a tupleReferences