mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
clippy: Fix some warnings in the script
crate (#31719)
* Fix InlineFormatting error * BoxFrament * fix clippy error * clippy:fix clipy errors * fix clippy errors * fix clippy errors * fix clippy errors * Remove changes to `layout_2020` --------- Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
4bca55e27a
commit
3ac0ab2e4e
6 changed files with 24 additions and 26 deletions
|
@ -183,8 +183,8 @@ impl CanvasState {
|
|||
global.origin().immutable().clone()
|
||||
};
|
||||
CanvasState {
|
||||
ipc_renderer: ipc_renderer,
|
||||
canvas_id: canvas_id,
|
||||
ipc_renderer,
|
||||
canvas_id,
|
||||
state: DomRefCell::new(CanvasContextState::new()),
|
||||
origin_clean: Cell::new(true),
|
||||
image_cache: global.image_cache(),
|
||||
|
|
|
@ -464,7 +464,7 @@ impl LocationMethods for Location {
|
|||
None => &value.0,
|
||||
};
|
||||
|
||||
if let Err(_) = copy_url.as_mut_url().set_scheme(scheme) {
|
||||
if copy_url.as_mut_url().set_scheme(scheme).is_err() {
|
||||
// Step 5: If possibleFailure is failure, then throw a "SyntaxError" DOMException.
|
||||
return Err(Error::Syntax);
|
||||
}
|
||||
|
|
|
@ -146,10 +146,8 @@ impl MediaFragmentParser {
|
|||
let vec: Vec<&str> = input.split('-').collect();
|
||||
let mut hms: Vec<f64> = vec
|
||||
.iter()
|
||||
.map(|s| NaiveDateTime::parse_from_str(s, "%Y%m%dT%H%M%S%.fZ"))
|
||||
.flatten()
|
||||
.map(|s| parse_hms(&s.time().to_string()))
|
||||
.flatten()
|
||||
.flat_map(|s| NaiveDateTime::parse_from_str(s, "%Y%m%dT%H%M%S%.fZ"))
|
||||
.flat_map(|s| parse_hms(&s.time().to_string()))
|
||||
.collect();
|
||||
|
||||
let end = hms.pop().ok_or_else(|| ())?;
|
||||
|
@ -166,7 +164,7 @@ impl MediaFragmentParser {
|
|||
fn parse_spatial(&self, input: &str) -> Result<SpatialClipping, ()> {
|
||||
let (prefix, s) = split_prefix(input);
|
||||
let vec: Vec<&str> = s.split(',').collect();
|
||||
let mut queue: VecDeque<u32> = vec.iter().map(|s| s.parse::<u32>()).flatten().collect();
|
||||
let mut queue: VecDeque<u32> = vec.iter().flat_map(|s| s.parse::<u32>()).collect();
|
||||
|
||||
let mut clipping = SpatialClipping {
|
||||
region: None,
|
||||
|
|
|
@ -90,7 +90,7 @@ impl Worklet {
|
|||
Worklet {
|
||||
reflector: Reflector::new(),
|
||||
window: Dom::from_ref(window),
|
||||
global_type: global_type,
|
||||
global_type,
|
||||
droppable_field: DroppableField {
|
||||
worklet_id: WorkletId::new(),
|
||||
thread_pool: OnceCell::new(),
|
||||
|
@ -285,12 +285,12 @@ impl WorkletThreadPool {
|
|||
primary_sender: primary_sender.clone(),
|
||||
hot_backup_sender: hot_backup_sender.clone(),
|
||||
cold_backup_sender: cold_backup_sender.clone(),
|
||||
global_init: global_init,
|
||||
global_init,
|
||||
};
|
||||
WorkletThreadPool {
|
||||
primary_sender: primary_sender,
|
||||
hot_backup_sender: hot_backup_sender,
|
||||
cold_backup_sender: cold_backup_sender,
|
||||
primary_sender,
|
||||
hot_backup_sender,
|
||||
cold_backup_sender,
|
||||
control_sender_0: WorkletThread::spawn(primary_role, init.clone(), 0),
|
||||
control_sender_1: WorkletThread::spawn(hot_backup_role, init.clone(), 1),
|
||||
control_sender_2: WorkletThread::spawn(cold_backup_role, init, 2),
|
||||
|
@ -320,13 +320,13 @@ impl WorkletThreadPool {
|
|||
&self.control_sender_2,
|
||||
] {
|
||||
let _ = sender.send(WorkletControl::FetchAndInvokeAWorkletScript {
|
||||
pipeline_id: pipeline_id,
|
||||
worklet_id: worklet_id,
|
||||
global_type: global_type,
|
||||
pipeline_id,
|
||||
worklet_id,
|
||||
global_type,
|
||||
origin: origin.clone(),
|
||||
base_url: base_url.clone(),
|
||||
script_url: script_url.clone(),
|
||||
credentials: credentials,
|
||||
credentials,
|
||||
pending_tasks_struct: pending_tasks_struct.clone(),
|
||||
promise: TrustedPromise::new(promise.clone()),
|
||||
});
|
||||
|
@ -405,8 +405,8 @@ impl WorkletThreadRole {
|
|||
WorkletThreadRole {
|
||||
sender: sender,
|
||||
receiver: receiver,
|
||||
is_hot_backup: is_hot_backup,
|
||||
is_cold_backup: is_cold_backup,
|
||||
is_hot_backup,
|
||||
is_cold_backup,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -481,8 +481,8 @@ impl WorkletThread {
|
|||
let roots = RootCollection::new();
|
||||
let _stack_roots = ThreadLocalStackRoots::new(&roots);
|
||||
let mut thread = RootedTraceableBox::new(WorkletThread {
|
||||
role: role,
|
||||
control_receiver: control_receiver,
|
||||
role,
|
||||
control_receiver,
|
||||
primary_sender: init.primary_sender,
|
||||
hot_backup_sender: init.hot_backup_sender,
|
||||
cold_backup_sender: init.cold_backup_sender,
|
||||
|
@ -767,8 +767,8 @@ pub struct WorkletExecutor {
|
|||
impl WorkletExecutor {
|
||||
fn new(worklet_id: WorkletId, primary_sender: Sender<WorkletData>) -> WorkletExecutor {
|
||||
WorkletExecutor {
|
||||
worklet_id: worklet_id,
|
||||
primary_sender: primary_sender,
|
||||
worklet_id,
|
||||
primary_sender,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1558,7 +1558,7 @@ impl XMLHttpRequest {
|
|||
let xhr = Trusted::new(self);
|
||||
|
||||
let context = Arc::new(Mutex::new(XHRContext {
|
||||
xhr: xhr,
|
||||
xhr,
|
||||
gen_id: self.generation_id.get(),
|
||||
sync_status: DomRefCell::new(None),
|
||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||
|
|
|
@ -87,8 +87,8 @@ pub fn fetch_image_for_layout(
|
|||
let document = document_from_node(node);
|
||||
|
||||
let context = Arc::new(Mutex::new(LayoutImageContext {
|
||||
id: id,
|
||||
cache: cache,
|
||||
id,
|
||||
cache,
|
||||
resource_timing: ResourceFetchTiming::new(ResourceTimingType::Resource),
|
||||
doc: Trusted::new(&document),
|
||||
url: url.clone(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue