clippy: fix several lint warns (#32126)

As seems #31500 still remain opened here's the next partial fix.

Fixed list: `unused_mut`, `clippy::needless_borrow`,
`clippy::match_ref_pats`, `clippy::borrow_deref_ref`, `clippy::ptr_eq`,
`clippy::unnecessary_cast`, `clippy::derivable_impls`,
`clippy::collapsible_match`, `clippy::extra_unused_lifetimes`,
`clippy::map_clone`, `clippy::manual_filter`.


- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes are part of #31500.
- [x] These changes do not require tests because are only cosmetic.
This commit is contained in:
Kitsu 2024-04-22 03:45:39 -03:00 committed by GitHub
parent 025a987732
commit 67f239d1ba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 54 additions and 83 deletions

View file

@ -555,7 +555,7 @@ impl LayoutThread {
}
/// Receives and dispatches messages from the script and constellation threads
fn handle_request<'a, 'b>(&mut self, request: Request) {
fn handle_request(&mut self, request: Request) {
match request {
Request::FromPipeline(LayoutControlMsg::SetScrollStates(new_scroll_states)) => {
self.handle_request_helper(Msg::SetScrollStates(new_scroll_states))
@ -629,13 +629,13 @@ impl LayoutThread {
) {
// Find all font-face rules and notify the font cache of them.
// GWTODO: Need to handle unloading web fonts.
if stylesheet.is_effective_for_device(self.stylist.device(), &guard) {
if stylesheet.is_effective_for_device(self.stylist.device(), guard) {
let newly_loading_font_count = self
.font_cache_thread
.lock()
.add_all_web_fonts_from_stylesheet(
&*stylesheet,
&guard,
stylesheet,
guard,
self.stylist.device(),
&self.font_cache_sender,
self.debug.load_webfonts_synchronously,
@ -658,7 +658,7 @@ impl LayoutThread {
}
/// Sets quirks mode for the document, causing the quirks mode stylesheet to be used.
fn handle_set_quirks_mode<'a, 'b>(&mut self, quirks_mode: QuirksMode) {
fn handle_set_quirks_mode(&mut self, quirks_mode: QuirksMode) {
self.stylist.set_quirks_mode(quirks_mode);
}
@ -1048,7 +1048,7 @@ impl LayoutThread {
.borrow()
.iter()
.filter_map(|(browsing_context_id, size)| {
match old_iframe_sizes.get(&browsing_context_id) {
match old_iframe_sizes.get(browsing_context_id) {
Some(old_size) if old_size != size => Some(IFrameSizeMsg {
browsing_context_id: *browsing_context_id,
size: *size,
@ -1145,17 +1145,17 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
// (Does it make a difference?)
let mut user_or_user_agent_stylesheets = vec![
parse_ua_stylesheet(
&shared_lock,
shared_lock,
"user-agent.css",
&resources::read_bytes(Resource::UserAgentCSS),
)?,
parse_ua_stylesheet(
&shared_lock,
shared_lock,
"servo.css",
&resources::read_bytes(Resource::ServoCSS),
)?,
parse_ua_stylesheet(
&shared_lock,
shared_lock,
"presentational-hints.css",
&resources::read_bytes(Resource::PresentationalHintsCSS),
)?,
@ -1164,7 +1164,7 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
for &(ref contents, ref url) in &opts::get().user_stylesheets {
user_or_user_agent_stylesheets.push(DocumentStyleSheet(ServoArc::new(
Stylesheet::from_bytes(
&contents,
contents,
UrlExtraData(url.get_arc()),
None,
None,
@ -1179,7 +1179,7 @@ fn get_ua_stylesheets() -> Result<UserAgentStylesheets, &'static str> {
}
let quirks_mode_stylesheet = parse_ua_stylesheet(
&shared_lock,
shared_lock,
"quirks-mode.css",
&resources::read_bytes(Resource::QuirksModeCSS),
)?;
@ -1248,7 +1248,7 @@ struct RegisteredPaintersImpl(FnvHashMap<Atom, RegisteredPainterImpl>);
impl RegisteredSpeculativePainters for RegisteredPaintersImpl {
fn get(&self, name: &Atom) -> Option<&dyn RegisteredSpeculativePainter> {
self.0
.get(&name)
.get(name)
.map(|painter| painter as &dyn RegisteredSpeculativePainter)
}
}