mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
clippy: Fix a few problems in components/scripts
(#31959)
* fixed various clippy warnings * fixed various clippy warnings
This commit is contained in:
parent
00c4d798c9
commit
52a74287fc
5 changed files with 6 additions and 6 deletions
|
@ -953,7 +953,7 @@ impl CanvasState {
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalalpha
|
// https://html.spec.whatwg.org/multipage/#dom-context-2d-globalalpha
|
||||||
pub fn set_global_alpha(&self, alpha: f64) {
|
pub fn set_global_alpha(&self, alpha: f64) {
|
||||||
if !alpha.is_finite() || alpha > 1.0 || alpha < 0.0 {
|
if !alpha.is_finite() || !(0.0..=1.0).contains(&alpha) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl XRInputSourceArray {
|
||||||
// This is quadratic, but won't be a problem for the only case
|
// This is quadratic, but won't be a problem for the only case
|
||||||
// where we add multiple input sources (the initial input sources case)
|
// where we add multiple input sources (the initial input sources case)
|
||||||
debug_assert!(
|
debug_assert!(
|
||||||
input_sources.iter().find(|i| i.id() == info.id).is_none(),
|
!input_sources.iter().any(|i| i.id() == info.id),
|
||||||
"Should never add a duplicate input id!"
|
"Should never add a duplicate input id!"
|
||||||
);
|
);
|
||||||
let input = XRInputSource::new(&global, session, info.clone());
|
let input = XRInputSource::new(&global, session, info.clone());
|
||||||
|
|
|
@ -109,7 +109,7 @@ impl XRRenderState {
|
||||||
if let Some(base_layer) = self.base_layer.get() {
|
if let Some(base_layer) = self.base_layer.get() {
|
||||||
match sub_images.len() {
|
match sub_images.len() {
|
||||||
// For inline sessions, there may be a base layer, but it won't have a framebuffer
|
// For inline sessions, there may be a base layer, but it won't have a framebuffer
|
||||||
0 => base_layer.layer_id() == None,
|
0 => base_layer.layer_id().is_none(),
|
||||||
// For immersive sessions, the base layer will have a framebuffer,
|
// For immersive sessions, the base layer will have a framebuffer,
|
||||||
// so we make sure the layer id's match up
|
// so we make sure the layer id's match up
|
||||||
1 => base_layer.layer_id() == Some(sub_images[0].layer_id),
|
1 => base_layer.layer_id() == Some(sub_images[0].layer_id),
|
||||||
|
|
|
@ -615,7 +615,7 @@ impl ModuleTree {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 2.
|
// Step 2.
|
||||||
if !specifier_str.starts_with("/") &&
|
if !specifier_str.starts_with('/') &&
|
||||||
!specifier_str.starts_with("./") &&
|
!specifier_str.starts_with("./") &&
|
||||||
!specifier_str.starts_with("../")
|
!specifier_str.starts_with("../")
|
||||||
{
|
{
|
||||||
|
|
|
@ -3108,7 +3108,7 @@ impl ScriptThread {
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
let opener_browsing_context = opener.and_then(|id| ScriptThread::find_window_proxy(id));
|
let opener_browsing_context = opener.and_then(ScriptThread::find_window_proxy);
|
||||||
|
|
||||||
let creator = CreatorBrowsingContextInfo::from(
|
let creator = CreatorBrowsingContextInfo::from(
|
||||||
parent_browsing_context.as_deref(),
|
parent_browsing_context.as_deref(),
|
||||||
|
@ -3164,7 +3164,7 @@ impl ScriptThread {
|
||||||
_ => None,
|
_ => None,
|
||||||
};
|
};
|
||||||
|
|
||||||
let opener_browsing_context = opener.and_then(|id| ScriptThread::find_window_proxy(id));
|
let opener_browsing_context = opener.and_then(ScriptThread::find_window_proxy);
|
||||||
|
|
||||||
let creator = CreatorBrowsingContextInfo::from(
|
let creator = CreatorBrowsingContextInfo::from(
|
||||||
parent_browsing_context.as_deref(),
|
parent_browsing_context.as_deref(),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue