diff options
author | Pi-Cla <pirateclip@protonmail.com> | 2024-05-02 14:02:21 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-02 20:02:21 +0000 |
commit | 160c7c0b0f061afa1277fa56cdd1d898379a8223 (patch) | |
tree | 3ef1bf1092d13912ec702cb507fe6ebf2ec81702 /components/script/dom/servoparser | |
parent | ca064eaa518f407988751ce51834eff3d65b681c (diff) | |
download | servo-160c7c0b0f061afa1277fa56cdd1d898379a8223.tar.gz servo-160c7c0b0f061afa1277fa56cdd1d898379a8223.zip |
Fix some clippy warnings in `components/gfx` and `components/script` (#32215)
* clippy: Squish warnings and errors in gfx
warning: redundant closure (gfx/font.rs:415:18)
warning: useless conversion to the same type (gfx/font.rs:534:9)
warning: the following explicit lifetimes could be elided: 'a (gfx/font.rs:619:16)
error: this loop never actually loops (gfx/font_cache_thread.rs:112:9)
warning: this expression creates a reference which is immediately dereferenced by the compiler (gfx/font_cache_thread.rs:229:51)
warning: redundant closure (gfx/font_cache_thread.rs:551:18)
3 instances of:
warning: casting integer literal to `f64` is unnecessary (gfx/platform/freetype/font_list.rs:271-273)
* clippy: methods called `from_*` usually take no `self`
It reports that by standard convention, from_* methods should not take any `&self` parameter
* clippy: you should consider adding a `Default` implementation
It reports that public types with a pub fn new() -> Self should have a Default implementation since they can be constructed without arguments
* clippy: casting to the same type is unnecessary (`f32` -> `f32`)
* clippy: use of `unwrap_or_else` to construct default value
* clippy: methods called `is_*` usually take `self` by mutable reference or `self` by reference or no `self`
* clippy: manual `!RangeInclusive::contains` implementation
contains expresses the intent better and has less failure modes (such as fencepost errors or using || instead of &&)
* clippy: this function has an empty `#[must_use]` attribute, but returns a type already marked as `#[must_use]`
* clippy: Fix some new warnings
warning: this `if` statement can be collapsed (gfx/font.rs:468:130)
warning: this lifetime isn't used in the impl (gfx/platform/freetype/font.rs:341:6)
warning: field assignment outside of initializer for an instance created with Default::default() (compositor.rs:881:17)
Diffstat (limited to 'components/script/dom/servoparser')
-rw-r--r-- | components/script/dom/servoparser/async_html.rs | 1 | ||||
-rw-r--r-- | components/script/dom/servoparser/html.rs | 1 | ||||
-rw-r--r-- | components/script/dom/servoparser/mod.rs | 1 | ||||
-rw-r--r-- | components/script/dom/servoparser/xml.rs | 1 |
4 files changed, 0 insertions, 4 deletions
diff --git a/components/script/dom/servoparser/async_html.rs b/components/script/dom/servoparser/async_html.rs index 95081d753eb..7200b9ed5c6 100644 --- a/components/script/dom/servoparser/async_html.rs +++ b/components/script/dom/servoparser/async_html.rs @@ -283,7 +283,6 @@ impl Tokenizer { tokenizer } - #[must_use] pub fn feed(&mut self, input: &mut BufferQueue) -> TokenizerResult<DomRoot<HTMLScriptElement>> { let mut send_tendrils = VecDeque::new(); while let Some(str) = input.pop_front() { diff --git a/components/script/dom/servoparser/html.rs b/components/script/dom/servoparser/html.rs index 11b26869963..ade1fdf4613 100644 --- a/components/script/dom/servoparser/html.rs +++ b/components/script/dom/servoparser/html.rs @@ -78,7 +78,6 @@ impl Tokenizer { Tokenizer { inner } } - #[must_use] pub fn feed(&mut self, input: &mut BufferQueue) -> TokenizerResult<DomRoot<HTMLScriptElement>> { match self.inner.feed(input) { TokenizerResult::Done => TokenizerResult::Done, diff --git a/components/script/dom/servoparser/mod.rs b/components/script/dom/servoparser/mod.rs index 3d8fbc347b4..507e2a2cb99 100644 --- a/components/script/dom/servoparser/mod.rs +++ b/components/script/dom/servoparser/mod.rs @@ -698,7 +698,6 @@ enum Tokenizer { } impl Tokenizer { - #[must_use] fn feed(&mut self, input: &mut BufferQueue) -> TokenizerResult<DomRoot<HTMLScriptElement>> { match *self { Tokenizer::Html(ref mut tokenizer) => tokenizer.feed(input), diff --git a/components/script/dom/servoparser/xml.rs b/components/script/dom/servoparser/xml.rs index d07d6bc6afb..26b43910100 100644 --- a/components/script/dom/servoparser/xml.rs +++ b/components/script/dom/servoparser/xml.rs @@ -41,7 +41,6 @@ impl Tokenizer { Tokenizer { inner: tok } } - #[must_use] pub fn feed(&mut self, input: &mut BufferQueue) -> TokenizerResult<DomRoot<HTMLScriptElement>> { self.inner.run(input); match self.inner.sink.sink.script.take() { |