Open Bug 2094599 Opened 19 hours ago

Fix clippy warnings in netwerk/base/urlpattern_glue

Categories

(Developer Infrastructure :: Lint and Formatting, task)

task

Tracking

(Not tracked)

People

(Reporter: Sylvestre, Unassigned, Mentored)

References

(Blocks 1 open bug)

Details

(Keywords: good-first-bug, Whiteboard: [lang=rust])

Filing as a good first bug to learn workflows.

The crate in netwerk/base/urlpattern_glue triggers clippy warnings from the default lint set. Fix them all in a single patch; each one is a small, mechanical change and clippy's output suggests the fix.

Warnings and links to the code:
netwerk/base/urlpattern_glue/src/helpers.rs:157:36: the following explicit lifetimes could be elided: 'a [clippy::needless_lifetimes]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/helpers.rs#157
netwerk/base/urlpattern_glue/src/helpers.rs:167:13: the function matches_regexp_ffi doesn't need a mutable reference [clippy::unnecessary_mut_passed]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/helpers.rs#167
netwerk/base/urlpattern_glue/src/helpers.rs:198:24: the following explicit lifetimes could be elided: 'a [clippy::needless_lifetimes]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/helpers.rs#198
netwerk/base/urlpattern_glue/src/helpers.rs:425:1: an implementation of From is preferred since it gives you Into<_> for free where the reverse isn't true [clippy::from_over_into]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/helpers.rs#425
netwerk/base/urlpattern_glue/src/lib.rs:140:23: unneeded return statement [clippy::needless_return]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#140
netwerk/base/urlpattern_glue/src/lib.rs:141:19: unneeded return statement [clippy::needless_return]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#141
netwerk/base/urlpattern_glue/src/lib.rs:238:21: this assertion is always false [clippy::assertions_on_constants]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#238
netwerk/base/urlpattern_glue/src/lib.rs:295:17: this assertion is always false [clippy::assertions_on_constants]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#295
netwerk/base/urlpattern_glue/src/lib.rs:318:9: unneeded return statement [clippy::needless_return]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#318
netwerk/base/urlpattern_glue/src/lib.rs:320:9: unneeded return statement [clippy::needless_return]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/netwerk/base/urlpattern_glue/src/lib.rs#320

Note: for the two assertions_on_constants warnings (assert!(false)), check the intent of the surrounding code; the usual fix is unreachable!() or panic!() with a message.

To verify the fix:

./mach lint -W -l clippy netwerk/base/urlpattern_glue

The warnings above should no longer be reported, and the code should still build (./mach build).

Tutorial to contribute:
https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/contributing/stack_quickref.html

Please don't ask for the bug to be assigned. It will be automatically assigned to the first patch.

You need to log in before you can comment on or make changes to this bug.