Skip to main content

normalize

Function normalize 

Source
pub fn normalize(sel: &Selection) -> NormalizedSelection
Expand description

Normalizes a Selection toward a canonical form for structural comparison.

This rewrites the selection to eliminate redundant subtrees and bring structurally similar selections into a common representation. The result is suitable for comparison, hashing, and deduplication (e.g., in NormalizedSelectionKey).

Normalization preserves semantics but may alter syntactic structure. It is designed to improve over time as additional rewrites (e.g., flattening, simplification) are introduced.