зеркало из https://github.com/mozilla/gecko-dev.git
servo: Merge #8279 - Fix some rust-clippy violations (from frewsxcv:clippy-fixes); r=eefriedman
Source-Repo: https://github.com/servo/servo Source-Revision: 913ac568750502087a7f1693b3657a24cefd2460
This commit is contained in:
Родитель
fcd7ccb3e0
Коммит
9e37827713
|
@ -1024,17 +1024,12 @@ impl BlockFlow {
|
|||
let mut candidate_block_size_iterator = CandidateBSizeIterator::new(
|
||||
&self.fragment,
|
||||
self.base.block_container_explicit_block_size);
|
||||
loop {
|
||||
match candidate_block_size_iterator.next() {
|
||||
Some(candidate_block_size) => {
|
||||
candidate_block_size_iterator.candidate_value =
|
||||
match candidate_block_size {
|
||||
MaybeAuto::Auto => block_size,
|
||||
MaybeAuto::Specified(value) => value
|
||||
}
|
||||
while let Some(candidate_block_size) = candidate_block_size_iterator.next() {
|
||||
candidate_block_size_iterator.candidate_value =
|
||||
match candidate_block_size {
|
||||
MaybeAuto::Auto => block_size,
|
||||
MaybeAuto::Specified(value) => value
|
||||
}
|
||||
None => break,
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust `cur_b` as necessary to account for the explicitly-specified block-size.
|
||||
|
|
|
@ -562,8 +562,8 @@ impl VirtualMethods for HTMLScriptElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!("src") => {
|
||||
match *attr.local_name() {
|
||||
atom!("src") => {
|
||||
if let AttributeMutation::Set(_) = mutation {
|
||||
if !self.parser_inserted.get() && self.upcast::<Node>().is_in_doc() {
|
||||
self.prepare();
|
||||
|
|
|
@ -205,8 +205,8 @@ impl VirtualMethods for HTMLSelectElement {
|
|||
}
|
||||
|
||||
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
|
||||
match local_name {
|
||||
&atom!("size") => AttrValue::from_u32(value, DEFAULT_SELECT_SIZE),
|
||||
match *local_name {
|
||||
atom!("size") => AttrValue::from_u32(value, DEFAULT_SELECT_SIZE),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,18 +107,18 @@ impl VirtualMethods for HTMLTableCellElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!(bgcolor) => {
|
||||
match *attr.local_name() {
|
||||
atom!(bgcolor) => {
|
||||
self.background_color.set(mutation.new_value(attr).and_then(|value| {
|
||||
str::parse_legacy_color(&value).ok()
|
||||
}));
|
||||
},
|
||||
&atom!(colspan) => {
|
||||
atom!(colspan) => {
|
||||
self.colspan.set(mutation.new_value(attr).map(|value| {
|
||||
max(DEFAULT_COLSPAN, value.as_uint())
|
||||
}));
|
||||
},
|
||||
&atom!(width) => {
|
||||
atom!(width) => {
|
||||
let width = mutation.new_value(attr).map(|value| {
|
||||
str::parse_length(&value)
|
||||
});
|
||||
|
@ -129,8 +129,8 @@ impl VirtualMethods for HTMLTableCellElement {
|
|||
}
|
||||
|
||||
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
|
||||
match local_name {
|
||||
&atom!("colspan") => AttrValue::from_u32(value, DEFAULT_COLSPAN),
|
||||
match *local_name {
|
||||
atom!("colspan") => AttrValue::from_u32(value, DEFAULT_COLSPAN),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -141,24 +141,24 @@ impl VirtualMethods for HTMLTableElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!(bgcolor) => {
|
||||
match *attr.local_name() {
|
||||
atom!(bgcolor) => {
|
||||
self.background_color.set(mutation.new_value(attr).and_then(|value| {
|
||||
str::parse_legacy_color(&value).ok()
|
||||
}));
|
||||
},
|
||||
&atom!(border) => {
|
||||
atom!(border) => {
|
||||
// According to HTML5 § 14.3.9, invalid values map to 1px.
|
||||
self.border.set(mutation.new_value(attr).map(|value| {
|
||||
str::parse_unsigned_integer(value.chars()).unwrap_or(1)
|
||||
}));
|
||||
}
|
||||
&atom!(cellspacing) => {
|
||||
atom!(cellspacing) => {
|
||||
self.cellspacing.set(mutation.new_value(attr).and_then(|value| {
|
||||
str::parse_unsigned_integer(value.chars())
|
||||
}));
|
||||
},
|
||||
&atom!(width) => {
|
||||
atom!(width) => {
|
||||
let width = mutation.new_value(attr).map(|value| {
|
||||
str::parse_length(&value)
|
||||
});
|
||||
|
@ -169,8 +169,8 @@ impl VirtualMethods for HTMLTableElement {
|
|||
}
|
||||
|
||||
fn parse_plain_attribute(&self, local_name: &Atom, value: DOMString) -> AttrValue {
|
||||
match local_name {
|
||||
&atom!("border") => AttrValue::from_u32(value, 1),
|
||||
match *local_name {
|
||||
atom!("border") => AttrValue::from_u32(value, 1),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(local_name, value),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ impl VirtualMethods for HTMLTableRowElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!(bgcolor) => {
|
||||
match *attr.local_name() {
|
||||
atom!(bgcolor) => {
|
||||
self.background_color.set(mutation.new_value(attr).and_then(|value| {
|
||||
str::parse_legacy_color(&value).ok()
|
||||
}));
|
||||
|
|
|
@ -87,8 +87,8 @@ impl VirtualMethods for HTMLTableSectionElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!(bgcolor) => {
|
||||
match *attr.local_name() {
|
||||
atom!(bgcolor) => {
|
||||
self.background_color.set(mutation.new_value(attr).and_then(|value| {
|
||||
str::parse_legacy_color(&value).ok()
|
||||
}));
|
||||
|
|
|
@ -246,8 +246,8 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
|
||||
fn attribute_mutated(&self, attr: &Attr, mutation: AttributeMutation) {
|
||||
self.super_type().unwrap().attribute_mutated(attr, mutation);
|
||||
match attr.local_name() {
|
||||
&atom!(disabled) => {
|
||||
match *attr.local_name() {
|
||||
atom!(disabled) => {
|
||||
let el = self.upcast::<Element>();
|
||||
match mutation {
|
||||
AttributeMutation::Set(_) => {
|
||||
|
@ -261,13 +261,13 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
}
|
||||
}
|
||||
},
|
||||
&atom!(cols) => {
|
||||
atom!(cols) => {
|
||||
let cols = mutation.new_value(attr).map(|value| {
|
||||
value.as_uint()
|
||||
});
|
||||
self.cols.set(cols.unwrap_or(DEFAULT_COLS));
|
||||
},
|
||||
&atom!(rows) => {
|
||||
atom!(rows) => {
|
||||
let rows = mutation.new_value(attr).map(|value| {
|
||||
value.as_uint()
|
||||
});
|
||||
|
@ -286,9 +286,9 @@ impl VirtualMethods for HTMLTextAreaElement {
|
|||
}
|
||||
|
||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||
match name {
|
||||
&atom!("cols") => AttrValue::from_limited_u32(value, DEFAULT_COLS),
|
||||
&atom!("rows") => AttrValue::from_limited_u32(value, DEFAULT_ROWS),
|
||||
match *name {
|
||||
atom!("cols") => AttrValue::from_limited_u32(value, DEFAULT_COLS),
|
||||
atom!("rows") => AttrValue::from_limited_u32(value, DEFAULT_ROWS),
|
||||
_ => self.super_type().unwrap().parse_plain_attribute(name, value),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -885,8 +885,8 @@ fn first_node_not_in<I>(mut nodes: I, not_in: &[NodeOrString]) -> Option<Root<No
|
|||
{
|
||||
nodes.find(|node| {
|
||||
not_in.iter().all(|n| {
|
||||
match n {
|
||||
&NodeOrString::eNode(ref n) => n != node,
|
||||
match *n {
|
||||
NodeOrString::eNode(ref n) => n != node,
|
||||
_ => true,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -809,7 +809,7 @@ fn bp_position(a_node: &Node, a_offset: u32,
|
|||
} else if position & NodeConstants::DOCUMENT_POSITION_CONTAINS != 0 {
|
||||
// Step 3-1, 3-2.
|
||||
let mut b_ancestors = b_node.inclusive_ancestors();
|
||||
let ref child = b_ancestors.find(|child| {
|
||||
let child = b_ancestors.find(|child| {
|
||||
child.r().GetParentNode().unwrap().r() == a_node
|
||||
}).unwrap();
|
||||
// Step 3-3.
|
||||
|
|
|
@ -78,7 +78,7 @@ impl Ord for Timer {
|
|||
fn cmp(&self, other: &Timer) -> Ordering {
|
||||
match self.next_call.cmp(&other.next_call).reverse() {
|
||||
Ordering::Equal => self.handle.cmp(&other.handle).reverse(),
|
||||
res @ _ => res
|
||||
res => res
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче