X Tutup
Closed Bug 2006047 Opened 2 months ago Closed 2 months ago

Remove redundant specificity_and_flags wrapper and inline implementation

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
148 Branch
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.

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.

Assignee: nobody → nabeyang
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Pushed by ealvarez@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a3aa8952875a https://hg.mozilla.org/integration/autoland/rev/e1fba5c0c63b Remove redundant specificity_and_flags wrapper and inline implementation r=emilio,firefox-style-system-reviewers
Status: ASSIGNED → RESOLVED
Closed: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
QA Whiteboard: [qa-triage-done-c149/b148]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size:

X Tutup