pub struct Suppressions { /* private fields */ }Expand description
The byte ranges a file’s directives suppress, resolved per axis.
Ranges are sorted and non-overlapping (touching ones are merged), so a consumer can test containment with a plain scan and never has to reason about nesting.
Implementations§
Source§impl Suppressions
impl Suppressions
Sourcepub fn build(root: &SyntaxNode) -> Self
pub fn build(root: &SyntaxNode) -> Self
Scan root for directives and resolve them into ranges.
A skip-file becomes a range covering the whole document rather than a
flag, so every consumer keeps one code path: whole-file suppression is
just the widest region. (The document-level trailing-edge normalization
and the line_ending post-pass still run over the result — the same
carve-out protected regions already live under.)
An off with no matching on runs to end of file, as it does in every
other formatter that has the directive.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether the document carries no directive at all — the fast path for the overwhelming majority of files, so a consumer can skip its per-node test.
Sourcepub fn format_ranges(&self) -> &[TextRange]
pub fn format_ranges(&self) -> &[TextRange]
Ranges the formatter must reproduce byte-for-byte.
Sourcepub fn lint_all_ranges(&self) -> &[TextRange]
pub fn lint_all_ranges(&self) -> &[TextRange]
Ranges in which every lint rule is suppressed.
Trait Implementations§
Source§impl Clone for Suppressions
impl Clone for Suppressions
Source§fn clone(&self) -> Suppressions
fn clone(&self) -> Suppressions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more