Open Bug 2094597 Opened 19 hours ago

Fix clippy warnings in intl/l10n/rust/l10nregistry-ffi

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 intl/l10n/rust/l10nregistry-ffi 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:
intl/l10n/rust/l10nregistry-ffi/src/env.rs:104:5: variables can be used directly in the format! string [clippy::uninlined_format_args]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/env.rs#104
intl/l10n/rust/l10nregistry-ffi/src/load.rs:104:28: this can be std::io::Error::other(_) [clippy::io_other_error]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/load.rs#104
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:133:43: this expression creates a reference which is immediately dereferenced by the compiler [clippy::needless_borrow]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#133
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:239:36: this .into_iter() call is equivalent to .iter() and will not consume the Vec [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#239
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:368:45: redundant closure [clippy::redundant_closure]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#368
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:383:10: this .into_iter() call is equivalent to .iter() and will not consume the slice [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#383
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:387:17: this .into_iter() call is equivalent to .iter() and will not consume the slice [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#387
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:437:10: this .into_iter() call is equivalent to .iter() and will not consume the slice [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#437
intl/l10n/rust/l10nregistry-ffi/src/registry.rs:441:17: this .into_iter() call is equivalent to .iter() and will not consume the slice [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/registry.rs#441
intl/l10n/rust/l10nregistry-ffi/src/source.rs:118:6: this .into_iter() call is equivalent to .iter() and will not consume the slice [clippy::into_iter_on_ref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/source.rs#118
intl/l10n/rust/l10nregistry-ffi/src/source.rs:353:21: called .as_ref().map(|r| &**r) on an Option value [clippy::option_as_ref_deref]
https://searchfox.org/firefox-main/rev/cac2c0cf44beecb92c93119bd79e2408636f76d7/intl/l10n/rust/l10nregistry-ffi/src/source.rs#353

To verify the fix:

./mach lint -W -l clippy intl/l10n/rust/l10nregistry-ffi

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.