Remove redundant specificity _and _flags wrapper and inline implementation
Categories
(Core :: CSS Parsing and Computation, enhancement)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox148 | --- | fixed |
People
(Reporter: nabeyang, Assigned: nabeyang)
Details
Attachments
(1 file)
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Steps to reproduce:
Removed the redundant wrapper function specificity_and_flags that delegated to complex_selector_specificity_and_flags, and inlined the implementation by renaming the latter to specificity_and_flags. The unnecessary .into() call and separate function definition were eliminated.
Actual results:
The code contained two functions with overlapping responsibilities: a wrapper function and an implementation function. The wrapper simply forwarded its arguments to the implementation and returned the result, leading to unnecessary indirection. Additionally, an .into() conversion was performed despite both functions using the same return type, which was redundant.
Expected results:
The implementation should be consolidated under a single function named specificity_and_flags. The redundant wrapper and .into() should be removed to simplify the code and improve readability, with no change in behavior.
| Assignee | ||
Comment 1•2 months ago
|
||
The specificity_and_flags function was a simple wrapper around
complex_selector_specificity_and_flags, forwarding its arguments and
calling .into() on the result despite both functions returning
the same SpecificityAndFlags type.
Since the wrapper did not provide any additional behavior or abstraction,
and is only called from one location, this change consolidates the
implementation by renaming complex_selector_specificity_and_flags to
specificity_and_flags and removes the redundant wrapper and the
unnecessary .into() call.
No behavior changes are introduced by this cleanup, and all call sites
continue to function correctly with the consolidated definition.
Updated•2 months ago
|
Comment 3•2 months ago
|
||
| bugherder | ||
Updated•1 month ago
|
Description
•