Skip to content

Commit 855b059

Browse files
fix: resolve Clippy issues (#33)
1 parent 7c2ec6c commit 855b059

3 files changed

Lines changed: 21 additions & 22 deletions

File tree

packages/dom/src/queries/label_text.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,15 @@ pub fn _query_all_by_label_text<M: Into<Matcher>>(
4040
let label_list = get_labels(container, &labelled_element, Some(selector.clone()));
4141

4242
for label in &label_list {
43-
if let Some(form_control) = label.form_control.as_ref() {
44-
if matcher(
43+
if let Some(form_control) = label.form_control.as_ref()
44+
&& matcher(
4545
label.content.clone(),
4646
label.form_control.as_deref(),
4747
&text,
4848
match_normalizer.as_ref(),
49-
) {
50-
labelled_elements.push(form_control.clone());
51-
}
49+
)
50+
{
51+
labelled_elements.push(form_control.clone());
5252
}
5353
}
5454

packages/dom/src/role_helpers.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,11 @@ static ELEMENT_ROLE_LIST: LazyLock<Vec<ElementRole>> = LazyLock::new(|| {
8383

8484
result.push(ElementRole {
8585
r#match: Box::new(move |element| {
86-
if type_text_index.is_some() {
87-
if let Some(input_element) = element.dyn_ref::<HtmlInputElement>() {
88-
if input_element.type_() != "text" {
89-
return false;
90-
}
91-
}
86+
if type_text_index.is_some()
87+
&& let Some(input_element) = element.dyn_ref::<HtmlInputElement>()
88+
&& input_element.type_() != "text"
89+
{
90+
return false;
9291
}
9392

9493
element.matches(&selector).unwrap_or(false)

packages/pretty-format/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -203,17 +203,17 @@ fn create_indent(indent: usize) -> String {
203203
pub fn format(val: &JsValue, options: PrettyFormatOptions) -> Result<String, PrettyFormatError> {
204204
validate_options(&options)?;
205205

206-
if let Some(plugins) = &options.plugins {
207-
if let Some(plugin) = find_plugin(plugins, val) {
208-
return Ok(print_plugin(
209-
plugin,
210-
val,
211-
&get_config(options),
212-
"".into(),
213-
0,
214-
vec![],
215-
));
216-
}
206+
if let Some(plugins) = &options.plugins
207+
&& let Some(plugin) = find_plugin(plugins, val)
208+
{
209+
return Ok(print_plugin(
210+
plugin,
211+
val,
212+
&get_config(options),
213+
"".into(),
214+
0,
215+
vec![],
216+
));
217217
}
218218

219219
let basic_result = print_basic_value(

0 commit comments

Comments
 (0)