clippy: fix some warnings in desktop and some components (#32583)

* clippy: fix some warnings in ports/servoshell/desktop

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* style: fix formatting

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: fix warnings in bluetooth, devtools and servo components

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

* clippy: remove comments

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>

---------

Signed-off-by: ItsSunnyMonster <100400733+ItsSunnyMonster@users.noreply.github.com>
This commit is contained in:
ItsSunnyMonster 2024-06-25 19:04:23 +12:00 committed by GitHub
parent 6738902d45
commit 42e090a1eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 12 deletions

View file

@ -6,7 +6,7 @@ use std::collections::HashMap;
use std::error::Error;
use std::sync::Arc;
const NOT_SUPPORTED_ERROR: &'static str = "Error! Not supported platform!";
const NOT_SUPPORTED_ERROR: &str = "Error! Not supported platform!";
#[derive(Clone, Debug)]
pub struct EmptyAdapter {}

View file

@ -298,7 +298,7 @@ impl BrowsingContextActor {
if let Some(p) = pipeline {
self.active_pipeline.set(p);
}
*self.url.borrow_mut() = url.as_str().to_owned();
url.as_str().clone_into(&mut self.url.borrow_mut());
if let Some(ref t) = title {
self.title.borrow_mut().clone_from(t);
}

View file

@ -191,7 +191,7 @@ impl Actor for NetworkEventActor {
let mut headersSize = 0;
for (name, value) in self.request.headers.iter() {
let value = &value.to_str().unwrap().to_string();
rawHeadersString = rawHeadersString + name.as_str() + ":" + &value + "\r\n";
rawHeadersString = rawHeadersString + name.as_str() + ":" + value + "\r\n";
headersSize += name.as_str().len() + value.len();
headers.push(Header {
name: name.as_str().to_owned(),
@ -346,7 +346,7 @@ impl NetworkEventActor {
}
pub fn add_request(&mut self, request: DevtoolsHttpRequest) {
self.request.url = request.url.as_str().to_owned();
request.url.as_str().clone_into(&mut self.request.url);
self.request.method = request.method.clone();
self.request.headers = request.headers.clone();

View file

@ -135,7 +135,7 @@ mod media_platform {
match GStreamerBackend::init_with_plugins(
plugin_dir,
&gstreamer_plugins::GSTREAMER_PLUGINS,
gstreamer_plugins::GSTREAMER_PLUGINS,
) {
Ok(b) => b,
Err(e) => {

View file

@ -94,13 +94,14 @@ impl EventsLoop {
}
}
pub fn run_forever<F: 'static>(self, mut callback: F)
pub fn run_forever<F>(self, mut callback: F)
where
F: FnMut(
winit::event::Event<WakerEvent>,
Option<&winit::event_loop::EventLoopWindowTarget<WakerEvent>>,
&mut ControlFlow,
),
F: 'static
+ FnMut(
winit::event::Event<WakerEvent>,
Option<&winit::event_loop::EventLoopWindowTarget<WakerEvent>>,
&mut ControlFlow,
),
{
match self.0 {
EventLoop::Winit(events_loop) => {

View file

@ -173,7 +173,7 @@ impl Minibrowser {
let _duration = context.run(window, |ctx| {
// TODO: While in fullscreen add some way to mitigate the increased phishing risk
// when not displaying the URL bar: https://github.com/servo/servo/issues/32443
if !window.fullscreen().is_some() {
if window.fullscreen().is_none() {
TopBottomPanel::top("toolbar").show(ctx, |ui| {
ui.allocate_ui_with_layout(
ui.available_size(),