Skip to content

libservo: Fix dead code warning and fix two typos in unit tests#42375

Merged
mrobinson merged 5 commits intoservo:mainfrom
Keerti707:fix-servo-test-warning
Feb 6, 2026
Merged

libservo: Fix dead code warning and fix two typos in unit tests#42375
mrobinson merged 5 commits intoservo:mainfrom
Keerti707:fix-servo-test-warning

Conversation

@Keerti707
Copy link
Copy Markdown
Contributor

@Keerti707 Keerti707 commented Feb 5, 2026

This PR addresses a dead code warning removed during test builds by ensuring the servo test helper constructor is exercised. None of the functional behaviors are changed and this only improves test clarity and keeps the compiler output warning-free.

Fixes: #42364

@servo-highfive servo-highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 5, 2026
@Keerti707
Copy link
Copy Markdown
Contributor Author

I have opened a PR for this,please check it, I would really appreciate some feedback!

@simonwuelker
Copy link
Copy Markdown
Contributor

Thank you, this looks good!

You just need to sign-off your commits before we can merge this, see https://book.servo.org/contributing/git-setup.html#starting-a-new-change.
You can do this for an existing commit with git commit --amend -s --no-edit.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.61%. Comparing base (10209cc) to head (48a6fdc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #42375      +/-   ##
==========================================
+ Coverage   47.58%   47.61%   +0.02%     
==========================================
  Files         296      296              
  Lines       70633    70633              
  Branches    70633    70633              
==========================================
+ Hits        33614    33632      +18     
+ Misses      35585    35565      -20     
- Partials     1434     1436       +2     
Flag Coverage Δ
unittests 47.61% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Keerti707
Copy link
Copy Markdown
Contributor Author

Thank you, this looks good!

You just need to sign-off your commits before we can merge this, see https://book.servo.org/contributing/git-setup.html#starting-a-new-change. You can do this for an existing commit with git commit --amend -s --no-edit.

thank you! I have now tried signing off my commits,I hope its working that way too!

@simonwuelker
Copy link
Copy Markdown
Contributor

simonwuelker commented Feb 5, 2026

Hmm your commits are not signed. You should see a line like Signed-off by: XYZat the end of the commit message.
It also looks like the change doesn't compile (see the failing CI job).

@Loirooriol
Copy link
Copy Markdown
Contributor

I have edited the message to use Fixes: #42364, this links the PR to the issue.

Your commit is still unsigned.

Copy link
Copy Markdown
Member

@shubhamg13 shubhamg13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you really want to deal with this error. Add #[expect(dead_code)] to this.

}

impl ServoTest {
pub(crate) fn new() -> Self {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function is used by other tests in webview.rs

@Keerti707 Keerti707 force-pushed the fix-servo-test-warning branch from ae60269 to bfb3878 Compare February 6, 2026 08:40
#[expect(dead_code)] // Used by some tests and not others
pub(crate) fn new() -> Self {
Self::new_with_builder(|builder| builder)
Self::new_with_builder(|b| b)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: please revert this

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay! thank you for the suggestion.
Really appreciate it!

Copy link
Copy Markdown
Member

@shubhamg13 shubhamg13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nits, rest LGTM.

@Keerti707 Keerti707 force-pushed the fix-servo-test-warning branch from df9af48 to 4970555 Compare February 6, 2026 09:56
@Keerti707
Copy link
Copy Markdown
Contributor Author

Hi! 👋
I have updated the PR :
I initially added a zero-argument ServoTest::new() constructor with #[expect(dead_code)] to fix the compile errors in tests but as per the given suggestion i reverted it and i have now done evrything that i could see from my end
All changes are now DCO-signed (Signed-off-by: Keerti Gupta [email protected]).
The branch should now compile cleanly, and the DCO check passes. Please let me know if anything else needs adjustment. Thank you!

@shubhamg13 shubhamg13 added the T-coverage Do a try run with test coverage label Feb 6, 2026
@github-actions github-actions bot removed the T-coverage Do a try run with test coverage label Feb 6, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

🔨 Triggering try run (#21747201717) for Linux (Coverage)

Copy link
Copy Markdown
Member

@mrobinson mrobinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Keerti707 I think you accidentally removed your fixes for the dead code and left the unrelated changes. Please take another look.

impl ServoTest {
pub(crate) fn new() -> Self {
Self::new_with_builder(|builder| builder)
Self::new_with_builder(|b| b)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this one still needs to be reverted.

Copy link
Copy Markdown
Contributor Author

@Keerti707 Keerti707 Feb 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for pointing that out..you are right I reverted the unrelated builder rename,I have now fixed that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now the fixes for the dead code are made too!
I am sorry for the confusion I caused by mistake
Please take a look at the PR now!
I hope it works correctly as per the need.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Feb 6, 2026

✨ Try run (#21747201717) succeeded.

Signed-off-by: Keerti Gupta this side!! <[email protected]>
Add dead code expectation for ServoTest::new function.

Signed-off-by: Keerti Gupta this side!! <[email protected]>
@mrobinson mrobinson changed the title Removing dead code warning for servo test helper tests to improve servo test libservo: Fix dead code warning and fix two typos in unit tests Feb 6, 2026
@servo-highfive servo-highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Feb 6, 2026
@mrobinson mrobinson enabled auto-merge February 6, 2026 12:02
@mrobinson mrobinson added this pull request to the merge queue Feb 6, 2026
@servo-highfive servo-highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 6, 2026
github-merge-queue bot pushed a commit that referenced this pull request Feb 6, 2026
This PR addresses a dead code warning removed during test builds by
ensuring the servo test helper constructor is exercised. None of the
functional behaviors are changed and this only improves test clarity and
keeps the compiler output warning-free.

Fixes: #42364

---------

Signed-off-by: Keerti Gupta this side!! <[email protected]>
Signed-off-by: Keerti Gupta <[email protected]>
Merged via the queue into servo:main with commit 4c2327e Feb 6, 2026
31 checks passed
@servo-highfive servo-highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Feb 6, 2026
utilities and also the event handling

Signed-off-by: Keerti Gupta <[email protected]>
Remove unused dead code expectation and clean up formatting.

Signed-off-by: Keerti Gupta this side!! <[email protected]>
}

impl ServoTest {
#[expect(dead_code)] // Used by some tests and not others
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's sometimes used, it doesn't make sense to expect it to be dead.
Now I'm getting

warning: this lint expectation is unfulfilled
  --> components/servo/tests/common/mod.rs:25:14
   |
25 |     #[expect(dead_code)] // Used by some tests and not others
   |              ^^^^^^^^^
   |
   = note: `#[warn(unfulfilled_lint_expectations)]` on by default

So please use allow(dead_code) instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for noticing that!
I have made the necessary changes!
I hope its working now.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR already landed, you need to open a new one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning when compiling unit tests

7 participants