Skip to content

Commit b591923

Browse files
committed
Fix new nightly clippy suggestions in type trie and linker
1 parent 1693d02 commit b591923

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

crates/rustc_codegen_spirv-types/src/compile_result.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a> Trie<'a> {
6969

7070
fn emit(&self, builder: &mut String, full_name: String, indent: usize) {
7171
let mut children = self.children.iter().collect::<Vec<_>>();
72-
children.sort_unstable_by(|(k1, _), (k2, _)| k1.cmp(k2));
72+
children.sort_unstable_by_key(|(k1, _)| *k1);
7373
for (child_name, child) in children {
7474
let full_child_name = if full_name.is_empty() {
7575
(*child_name).to_string()

crates/rustc_codegen_spirv/src/linker/specializer.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -879,14 +879,13 @@ impl<'a> InferOperandList<'a> {
879879

880880
// Maybe filter this operand, but only *after* consuming the "generic" args for it.
881881
match self.transform {
882-
None => {}
883-
884882
// Skip a non-ID operand.
885-
Some(InferOperandListTransform::TypeOfId) => {
886-
if first_operand.id_ref_any().is_none() {
887-
continue;
888-
}
883+
Some(InferOperandListTransform::TypeOfId)
884+
if first_operand.id_ref_any().is_none() =>
885+
{
886+
continue;
889887
}
888+
None | Some(InferOperandListTransform::TypeOfId) => {}
890889
}
891890

892891
// Maybe replace this operand with a different one.

crates/rustc_codegen_spirv/src/linker/spirt_passes/diagnostics.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ impl UseOrigin<'_> {
336336
inst_attrs: _,
337337
origin,
338338
} => {
339-
let func_desc = special_func
340-
.map(|special_func| match special_func {
339+
let func_desc = special_func.map_or_else(
340+
|| name_from_attrs(*func_attrs, "function"),
341+
|special_func| match special_func {
341342
SpecialFunc::Exported(&ExportKey::LinkName(name)) => {
342343
format!("function export `{}`", &cx[name])
343344
}
@@ -361,8 +362,8 @@ impl UseOrigin<'_> {
361362
"" => "unnamed function".into(),
362363
callee_name => format!("`{callee_name}`"),
363364
},
364-
})
365-
.unwrap_or_else(|| name_from_attrs(*func_attrs, "function"));
365+
},
366+
);
366367
match origin {
367368
IntraFuncUseOrigin::CallCallee => format!("called by {func_desc}"),
368369
IntraFuncUseOrigin::Other => format!("used from within {func_desc}"),

0 commit comments

Comments
 (0)