mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy: Fix collapsible_else_if warnings (#31853)
This commit is contained in:
parent
d814d05539
commit
f8a2eaea47
8 changed files with 37 additions and 52 deletions
|
@ -579,8 +579,7 @@ impl EventTarget {
|
|||
Some(CommonEventHandler::ErrorEventHandler(unsafe {
|
||||
OnErrorEventHandlerNonNull::new(cx, funobj)
|
||||
}))
|
||||
} else {
|
||||
if ty == &atom!("beforeunload") {
|
||||
} else if ty == &atom!("beforeunload") {
|
||||
Some(CommonEventHandler::BeforeUnloadEventHandler(unsafe {
|
||||
OnBeforeUnloadEventHandlerNonNull::new(cx, funobj)
|
||||
}))
|
||||
|
@ -590,7 +589,6 @@ impl EventTarget {
|
|||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
pub fn set_event_handler_common<T: CallbackContainer>(&self, ty: &str, listener: Option<Rc<T>>)
|
||||
|
|
|
@ -210,12 +210,10 @@ impl GPUDevice {
|
|||
}
|
||||
}
|
||||
self.try_remove_scope(s_id);
|
||||
} else {
|
||||
if let Err((err, _)) = result {
|
||||
} else if let Err((err, _)) = result {
|
||||
self.fire_uncaptured_error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn handle_error(&self, scope: ErrorScopeId, error: GPUError) {
|
||||
let mut context = self.scope_context.borrow_mut();
|
||||
|
|
|
@ -578,8 +578,8 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
} else {
|
||||
a.source.cmp(&b.source)
|
||||
}
|
||||
} else {
|
||||
if a.element
|
||||
} else if a
|
||||
.element
|
||||
.upcast::<Node>()
|
||||
.CompareDocumentPosition(b.element.upcast::<Node>()) &
|
||||
NodeConstants::DOCUMENT_POSITION_FOLLOWING ==
|
||||
|
@ -589,7 +589,6 @@ impl HTMLFormElementMethods for HTMLFormElement {
|
|||
} else {
|
||||
std::cmp::Ordering::Greater
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Step 6
|
||||
|
|
|
@ -2868,14 +2868,12 @@ fn filter_from_accept(s: &DOMString) -> Vec<FilterPattern> {
|
|||
for p in split_commas(s) {
|
||||
if let Some('.') = p.chars().nth(0) {
|
||||
filter.push(FilterPattern(p[1..].to_string()));
|
||||
} else {
|
||||
if let Some(exts) = mime_guess::get_mime_extensions_str(p) {
|
||||
} else if let Some(exts) = mime_guess::get_mime_extensions_str(p) {
|
||||
for ext in exts {
|
||||
filter.push(FilterPattern(ext.to_string()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filter
|
||||
}
|
||||
|
|
|
@ -167,14 +167,12 @@ impl HTMLSelectElement {
|
|||
|
||||
if let Some(last_selected) = last_selected {
|
||||
last_selected.set_selectedness(true);
|
||||
} else {
|
||||
if self.display_size() == 1 {
|
||||
} else if self.display_size() == 1 {
|
||||
if let Some(first_enabled) = first_enabled {
|
||||
first_enabled.set_selectedness(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn push_form_data(&self, data_set: &mut Vec<FormDatum>) {
|
||||
if self.Name().is_empty() {
|
||||
|
|
|
@ -92,13 +92,11 @@ impl StylePropertyMapReadOnlyMethods for StylePropertyMapReadOnly {
|
|||
} else {
|
||||
Ordering::Greater
|
||||
}
|
||||
} else {
|
||||
if let Ok(_) = custom_properties::parse_name(key2) {
|
||||
} else if let Ok(_) = custom_properties::parse_name(key2) {
|
||||
Ordering::Less
|
||||
} else {
|
||||
key1.cmp(key2)
|
||||
}
|
||||
}
|
||||
});
|
||||
result
|
||||
}
|
||||
|
|
|
@ -82,14 +82,12 @@ impl<'dom, LayoutDataType: LayoutDataTrait> fmt::Debug for ServoLayoutNode<'dom,
|
|||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
if let Some(el) = self.as_element() {
|
||||
el.fmt(f)
|
||||
} else {
|
||||
if self.is_text_node() {
|
||||
} else if self.is_text_node() {
|
||||
write!(f, "<text node> ({:#x})", self.opaque().0)
|
||||
} else {
|
||||
write!(f, "<non-text node> ({:#x})", self.opaque().0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<'dom, LayoutDataType: LayoutDataTrait> ServoLayoutNode<'dom, LayoutDataType> {
|
||||
|
|
|
@ -627,8 +627,7 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
if self.selection_origin.is_none() {
|
||||
self.selection_origin = Some(self.edit_point);
|
||||
}
|
||||
} else {
|
||||
if self.has_selection() {
|
||||
} else if self.has_selection() {
|
||||
self.edit_point = match adjust {
|
||||
Direction::Backward => self.selection_start(),
|
||||
Direction::Forward => self.selection_end(),
|
||||
|
@ -636,7 +635,6 @@ impl<T: ClipboardProvider> TextInput<T> {
|
|||
self.clear_selection();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue