Skip to content

Commit

Permalink
Update Clippy (#3645)
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda authored Oct 6, 2023
1 parent 5d0f935 commit 277b20f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions crates/cli-support/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2274,7 +2274,7 @@ impl<'a> Context<'a> {
};
self.js_imports
.entry(module)
.or_insert(Vec::new())
.or_default()
.push((name.to_string(), rename));
}

Expand Down Expand Up @@ -4032,9 +4032,15 @@ fn check_duplicated_getter_and_setter_names(
}

fn format_doc_comments(comments: &str, js_doc_comments: Option<String>) -> String {
let body: String = comments.lines().map(|c| format!("*{}\n", c)).collect();
let body: String = comments.lines().fold(String::new(), |mut output, c| {
let _ = writeln!(output, "*{}", c);
output
});
let doc = if let Some(docs) = js_doc_comments {
docs.lines().map(|l| format!("* {}\n", l)).collect()
docs.lines().fold(String::new(), |mut output: String, l| {
let _ = writeln!(output, "* {}", l);
output
})
} else {
String::new()
};
Expand All @@ -4049,7 +4055,7 @@ fn require_class<'a>(
.as_mut()
.expect("classes already written")
.entry(name.to_string())
.or_insert_with(ExportedClass::default)
.or_default()
}

/// Returns whether a character has the Unicode `ID_Start` properly.
Expand Down Expand Up @@ -4140,10 +4146,8 @@ impl ExportedClass {
is_setter: bool,
is_static: bool,
) -> &mut bool {
let (ty_dst, accessor_docs, has_setter, is_optional, is_static_dst) = self
.typescript_fields
.entry(field.to_string())
.or_insert_with(Default::default);
let (ty_dst, accessor_docs, has_setter, is_optional, is_static_dst) =
self.typescript_fields.entry(field.to_string()).or_default();

*ty_dst = ty.to_string();
// Deterministic output: always use the getter's docs if available
Expand Down
4 changes: 2 additions & 2 deletions crates/cli-support/src/wit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ impl<'a> Context<'a> {
}
self.vendor_prefixes
.entry(ty.name.to_string())
.or_insert(Vec::new())
.or_default()
.extend(ty.vendor_prefixes.iter().map(|s| s.to_string()));
}
}
Expand All @@ -461,7 +461,7 @@ impl<'a> Context<'a> {
self.aux
.snippets
.entry(unique_crate_identifier.to_string())
.or_insert(Vec::new())
.or_default()
.extend(inline_js.iter().map(|s| s.to_string()));
Ok(())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/webidl/src/first_pass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1429,7 +1429,7 @@ impl<T> Eq for IgnoreTraits<T> {}

impl<T> PartialOrd for IgnoreTraits<T> {
fn partial_cmp(&self, _other: &IgnoreTraits<T>) -> Option<Ordering> {
Some(Ordering::Equal)
Some(self.cmp(_other))
}
}

Expand Down

0 comments on commit 277b20f

Please sign in to comment.