fix(rsx): formatted attribute merging (#3719)

* test(rsx): add better tests for attributes merging

* fix(rsx): zero-lengthed source with non-empty segments is non-trivial

* refactor(rsx): use `is_empty` instead of `len() == 0` (clippy)

* fix(rsx): different asserts whether in release or not
This commit is contained in:
Youn Mélois authored and GitHub committed 2025-04-15 14:28:14 -07:00
1 parent c58d7303b8
commit fd65c12bf5
2 files changed
+129 -8

No files matched your search

+5
View File
@@ -90,6 +90,11 @@ impl IfmtInput {
}
fn is_simple_expr(&self) -> bool {
// If there are segments but the source is empty, it's not a simple expression.
if !self.segments.is_empty() && self.source.span().byte_range().is_empty() {
return false;
}
self.segments.iter().all(|seg| match seg {
Segment::Literal(_) => true,
Segment::Formatted(FormattedSegment { segment, .. }) => {