Open Bug 2094605 Opened 3 days ago

Fix clippy warnings in toolkit/components/uniffi-bindgen-gecko-js

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 toolkit/components/uniffi-bindgen-gecko-js 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:
toolkit/components/uniffi-bindgen-gecko-js/src/filters.rs:13:38: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/filters.rs#13
toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs:138:5: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs#138
toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs:138:41: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs#138
toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs:166:26: the borrowed expression implements the required traits [clippy::needless_borrows_for_generic_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/lib.rs#166
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/context.rs:113:17: usage of contains_key followed by insert on a HashMap [clippy::map_entry]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/context.rs#113
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs:70:35: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs#70
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs:88:27: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs#88
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs:89:31: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs#89
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs:90:25: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/defaults.rs#90
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/interfaces.rs:25:17: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/interfaces.rs#25
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/interfaces.rs:29:34: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/interfaces.rs#29
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/namespaces.rs:12:57: this expression creates a reference which is immediately dereferenced by the compiler [clippy::needless_borrow]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/namespaces.rs#12
toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/types.rs:86:37: useless use of format! [clippy::useless_format]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/toolkit/components/uniffi-bindgen-gecko-js/src/pipeline/types.rs#86

To verify the fix:

./mach lint -W -l clippy toolkit/components/uniffi-bindgen-gecko-js

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.