diff --git a/crates/rustc_codegen_spirv/src/link.rs b/crates/rustc_codegen_spirv/src/link.rs index cf74422913..2c71ba82c7 100644 --- a/crates/rustc_codegen_spirv/src/link.rs +++ b/crates/rustc_codegen_spirv/src/link.rs @@ -317,10 +317,8 @@ fn do_spirv_opt( ); match result { - Ok(binary) => match binary { - spirv_tools::binary::Binary::OwnedU32(words) => words, - _ => binary.as_words().to_vec(), - }, + Ok(spirv_tools::binary::Binary::OwnedU32(words)) => words, + Ok(binary) => binary.as_words().to_vec(), Err(e) => { let mut err = sess.struct_warn(&e.to_string()); err.note("spirv-opt failed, leaving as unoptimized"); diff --git a/crates/rustc_codegen_spirv/src/linker/simple_passes.rs b/crates/rustc_codegen_spirv/src/linker/simple_passes.rs index 0721ed0375..3fa5153a19 100644 --- a/crates/rustc_codegen_spirv/src/linker/simple_passes.rs +++ b/crates/rustc_codegen_spirv/src/linker/simple_passes.rs @@ -173,7 +173,7 @@ pub fn check_fragment_insts(sess: &Session, module: &Module) -> Result<()> { .map(|i| func_id_to_idx[&i.operands[1].unwrap_id_ref()]); let mut any_err = None; for entry in entries { - any_err = any_err.or(visit( + let entry_had_err = visit( sess, module, &mut visited, @@ -182,7 +182,8 @@ pub fn check_fragment_insts(sess: &Session, module: &Module) -> Result<()> { entry, &func_id_to_idx, ) - .err()); + .err(); + any_err = any_err.or(entry_had_err); } return match any_err { Some(err) => Err(err), @@ -206,17 +207,10 @@ pub fn check_fragment_insts(sess: &Session, module: &Module) -> Result<()> { let mut any_err = None; for inst in module.functions[index].all_inst_iter() { if inst.class.opcode == Op::FunctionCall { - let called_func = func_id_to_idx[&inst.operands[0].unwrap_id_ref()]; - any_err = any_err.or(visit( - sess, - module, - visited, - stack, - names, - called_func, - func_id_to_idx, - ) - .err()); + let callee = func_id_to_idx[&inst.operands[0].unwrap_id_ref()]; + let callee_had_err = + visit(sess, module, visited, stack, names, callee, func_id_to_idx).err(); + any_err = any_err.or(callee_had_err); } if matches!( inst.class.opcode, diff --git a/examples/shaders/reduce/src/lib.rs b/examples/shaders/reduce/src/lib.rs index bd2ed95607..ed8cf0fa08 100644 --- a/examples/shaders/reduce/src/lib.rs +++ b/examples/shaders/reduce/src/lib.rs @@ -4,6 +4,7 @@ feature(register_attr), register_attr(spirv) )] +#![allow(clippy::too_many_arguments, clippy::missing_safety_doc)] // HACK(eddyb) can't easily see warnings otherwise from `spirv-builder` builds. #![deny(warnings)] use spirv_std::glam::UVec3;