Skip to content

clippy: Fix four warnings - #32789

Merged
mrobinson merged 3 commits into
servo:mainfrom
optician:clippy-chores
Jul 17, 2024
Merged

mrobinson merged 3 commits into
servo:mainfrom
optician:clippy-chores

Conversation

@optician

@optician optician commented Jul 17, 2024 •

Copy link
Copy Markdown
Contributor

Fixes 4 clippy rules. I aggregated clippy output before and after with ./mach cargo-clippy 2>&1 | rg 'warning:' | sort | uniq -c. The diff is:

*** before	Wed Jul 17 06:17:01 2024
--- after	Wed Jul 17 08:31:58 2024
***************
*** 5,11 ****
     1 warning: `layout_thread_2013` (lib) generated 1 warning
     1 warning: `layout_thread_2020` (lib) generated 2 warnings
     1 warning: `libservo` (lib) generated 3 warnings (run `cargo clippy --fix --lib -p libservo` to apply 1 suggestion)
!    1 warning: `script` (lib) generated 51 warnings (run `cargo clippy --fix --lib -p script` to apply 1 suggestion)
     1 warning: `servoshell` (lib) generated 1 warning
     1 warning: all variants have the same postfix: `Element`
     1 warning: all variants have the same postfix: `Error`
--- 5,11 ----
     1 warning: `layout_thread_2013` (lib) generated 1 warning
     1 warning: `layout_thread_2020` (lib) generated 2 warnings
     1 warning: `libservo` (lib) generated 3 warnings (run `cargo clippy --fix --lib -p libservo` to apply 1 suggestion)
!    1 warning: `script` (lib) generated 47 warnings
     1 warning: `servoshell` (lib) generated 1 warning
     1 warning: all variants have the same postfix: `Element`
     1 warning: all variants have the same postfix: `Error`
***************
*** 14,20 ****
     1 warning: all variants have the same prefix: `From`
     1 warning: constructor `in_realm` has the same name as the type
     1 warning: docs for unsafe trait missing `# Safety` section
-    1 warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let`
     1 warning: large size difference between variants
     2 warning: methods called `from_*` usually take no `self`
     4 warning: methods called `new` usually return `Self`
--- 14,19 ----
***************
*** 26,36 ****
     1 warning: name `SPHT` contains a capitalized acronym
     1 warning: name `URL` contains a capitalized acronym
     1 warning: name `UUID` contains a capitalized acronym
-    1 warning: redundant closure
     1 warning: statics have by default a `'static` lifetime
     1 warning: struct `Node` has a public `len` method, but no `is_empty` method
     1 warning: struct `TimeRangesContainer` has a public `len` method, but no `is_empty` method
-    2 warning: the use of negated comparison operators on partially ordered types produces code that is hard to read and refactor, please consider using the `partial_cmp` method instead, to make it clear that the two values could be incomparable
     2 warning: this expression creates a reference which is immediately dereferenced by the compiler
     2 warning: this function has too many arguments (12/7)
     1 warning: this function has too many arguments (16/7)
--- 25,33 ----

  • These changes do not require tests because it doesn't change or reorganise logic.

Signed-off-by: Danila Matveev <[email protected]>
@optician
optician requested a review from gterzian as a code owner July 17, 2024 05:56
Comment thread components/script/dom/range.rs Resolved
Comment thread components/script/dom/range.rs Resolved
@mrobinson mrobinson changed the title Fixes 4 clippy rules clippy: Fix four warnings Jul 17, 2024
@mrobinson
mrobinson enabled auto-merge July 17, 2024 07:29
auto-merge was automatically disabled July 17, 2024 07:29

Head branch was pushed to by a user without write access

@mrobinson
mrobinson added this pull request to the merge queue Jul 17, 2024
Merged via the queue into servo:main with commit a0d2b36 Jul 17, 2024
Gae24 pushed a commit to Gae24/servo that referenced this pull request Jul 26, 2024
* Fixes 4 clippy rules

Signed-off-by: Danila Matveev <[email protected]>

* Rollbacks changes in range.rs and silences clippy::neg_cmp_op_on_partial_ord

Signed-off-by: Danila Matveev <[email protected]>

* Fixes a fmt issue

Signed-off-by: Danila Matveev <[email protected]>

---------

Signed-off-by: Danila Matveev <[email protected]>
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.

2 participants