Open Bug 2051331 Opened 1 month ago

Fix clippy warnings in dom/base/fragmentdirectives/

Categories

(Developer Infrastructure :: Lint and Formatting, 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 the Firefox contribution workflow.

clippy reports several warnings in the dom_fragmentdirectives crate. They are all small, mechanical fixes (most are auto-fixable with cargo clippy --fix).

dom/base/fragmentdirectives/fragment_directive_impl.rs:

  • L61, L72, L73, L74, L292: clippy::needless_borrow
  • L91: clippy::single_char_add_str
  • L173: clippy::map_all_any_identity
  • L180, L197, L208: clippy::needless_return
  • L294: clippy::filter_map_identity
  • L314: clippy::ptr_arg (use &[TextDirective] instead of &Vec<TextDirective>)

dom/base/fragmentdirectives/lib.rs:

  • L106: clippy::redundant_closure

Link to the code:
https://searchfox.org/mozilla-central/source/dom/base/fragmentdirectives/fragment_directive_impl.rs
https://searchfox.org/mozilla-central/source/dom/base/fragmentdirectives/lib.rs

To verify the fix:

./mach lint -W -l clippy dom/base/fragmentdirectives/

You can also reproduce and auto-fix most of them directly with cargo:

cd dom/base/fragmentdirectives && cargo clippy --fix

After fixing, ./mach lint -W -l clippy dom/base/fragmentdirectives/ should report no warnings.

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

Please do not 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.