Skip to content

Commit 7c8fcb4

Browse files
committed
Make clippy happy
1 parent e3c6776 commit 7c8fcb4

File tree

3 files changed

+31
-33
lines changed

3 files changed

+31
-33
lines changed

src/annotate_attributes.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ impl Processor {
142142
let mut variant_comment = None;
143143
let mut variant_str = None;
144144
for node in description.iter() {
145-
if let NodeData::Comment { contents } = &node.data {
146-
if contents.trim().starts_with("or:") {
147-
variant_comment = Some(node);
148-
variant_str = Some(StrTendril::from(contents.trim()[3..].trim_start()));
149-
}
145+
if let NodeData::Comment { contents } = &node.data
146+
&& contents.trim().starts_with("or:")
147+
{
148+
variant_comment = Some(node);
149+
variant_str = Some(StrTendril::from(contents.trim()[3..].trim_start()));
150150
}
151151
}
152152

@@ -276,14 +276,14 @@ impl Processor {
276276
let mut dd_children = dd.children.borrow_mut();
277277
if has_special_semantics {
278278
// Replace the trailing period with a separating colon.
279-
if let Some(last) = dd_children.last_mut() {
280-
if let NodeData::Text { contents } = &last.data {
281-
let mut text = contents.borrow_mut();
282-
*text = StrTendril::from(
283-
text.trim_end_matches(|c: char| c.is_ascii_whitespace() || c == '.'),
284-
);
285-
text.push_slice(": ");
286-
}
279+
if let Some(last) = dd_children.last_mut()
280+
&& let NodeData::Text { contents } = &last.data
281+
{
282+
let mut text = contents.borrow_mut();
283+
*text = StrTendril::from(
284+
text.trim_end_matches(|c: char| c.is_ascii_whitespace() || c == '.'),
285+
);
286+
text.push_slice(": ");
287287
}
288288
} else {
289289
// Insert an em dash.

src/dom_utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,10 +137,9 @@ pub fn scan_dom<F: FnMut(&Handle)>(handle: &Handle, f: &mut F) {
137137
template_contents: ref tc,
138138
..
139139
} = handle.data
140+
&& let Some(ref tc_handle) = *tc.borrow()
140141
{
141-
if let Some(ref tc_handle) = *tc.borrow() {
142-
scan_dom(tc_handle, f);
143-
}
142+
scan_dom(tc_handle, f);
144143
}
145144
}
146145

src/tag_omission.rs

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,17 @@ impl Processor {
6767
// If we encounter the Void elements section, look for the next dt.
6868
if node.is_html_element(&local_name!("dfn"))
6969
&& node.text_content().trim() == "Void elements"
70-
{
71-
if let Some(dt) = node
70+
&& let Some(dt) = node
7271
.parent_node()
7372
.filter(|n| n.is_html_element(&local_name!("dt")))
74-
{
75-
for dd in dom_utils::dt_descriptions(&dt) {
76-
dom_utils::scan_dom(&dd, &mut |n| {
77-
if n.is_html_element(&local_name!("code")) {
78-
let info = self.elements.entry(n.text_content()).or_default();
79-
info.is_void_element = true;
80-
}
81-
});
82-
}
73+
{
74+
for dd in dom_utils::dt_descriptions(&dt) {
75+
dom_utils::scan_dom(&dd, &mut |n| {
76+
if n.is_html_element(&local_name!("code")) {
77+
let info = self.elements.entry(n.text_content()).or_default();
78+
info.is_void_element = true;
79+
}
80+
});
8381
}
8482
}
8583

@@ -91,12 +89,13 @@ impl Processor {
9189
}
9290

9391
// If we see a <dl class="element">, record that.
94-
if node.is_html_element(&local_name!("dl")) && node.has_class("element") {
95-
if let Some(elem) = std::mem::take(&mut self.most_recent_element_dfn) {
96-
let info = self.elements.entry(elem).or_default();
97-
if info.dl.is_none() {
98-
info.dl = Some(node.clone());
99-
}
92+
if node.is_html_element(&local_name!("dl"))
93+
&& node.has_class("element")
94+
&& let Some(elem) = std::mem::take(&mut self.most_recent_element_dfn)
95+
{
96+
let info = self.elements.entry(elem).or_default();
97+
if info.dl.is_none() {
98+
info.dl = Some(node.clone());
10099
}
101100
}
102101
}

0 commit comments

Comments
 (0)